PDA

View Full Version : PHP ajax requests ruin performance



clabasky
3 Oct 2011, 6:29 PM
hello Sencha friends,

I've put together an app that uses a lot of ajax requests. The ajax requests to a php file that accesses a mysql database. I've uploaded the app to the ftp, and it works great on my phone when I'm connected to the wifi, but when I'm roaming around the town using 4g the ajax requests take a long time to get the response, and there is a long delay until the callback function is launched. I want to display loading screen/icon while the ajax request is waiting for the response.:-?



Ext.regController('login', {



login: function() {

Ext.Ajax.request({
url: 'login.php',
method: 'post',
params: {email: logincard.getValues().email, password: logincard.getValues().password,
zipcode: logincard.getValues().zipcode},

success: function(result, request) {


var responseText = result.responseText;


if (!(responseText === "")){
var sessionid = responseText;
//adds sessionid to idstore
idstore.add([{id: sessionid}]);
viewport.setActiveItem(maintabpanel);

// Ext.Msg.alert('Login achieved', 'welcome to NeighborFavor');
Ext.getCmp("loginviewport").destroy();

//loads data from localstorage proxy to store
ActiveFavorStore.load();

var numbfavors = ActiveFavorStore.data.length;
deliveriescard.tab.setBadge(numbfavors);

}
else{
//Display error messages "you have not filled out entire form"

Ext.Msg.alert('Login failed', 'incorrect email or password');
}
}
});

}