我的 Sencha Touch 2 应用程序有几个地方可以在单击按钮时发出 AJAX 请求。这是非常标准的东西:
console.log('Saving Billing Item at' + strURL);
Ext.Ajax.request({
url: strURL,
method: 'GET',
success: function (result, request) {
var resultJson = Ext.decode(result.responseText);
console.log('Response from Saving BillingItem:' + result.responseText);
data = Ext.decode(result.responseText);
if(data.ErrorMessage.indexOf("successfully") == -1) {
Ext.Msg.alert('Error!', 'Error saving Billing Item:' + data.ErrorMessage);
} else {
Ext.StoreMgr.get('BillingItemList').load();
Ext.ComponentManager.get('MainMenu').animateActiveItem(23, {
type: 'slide',
direction: 'right'
}); //back to list
}
Ext.ComponentManager.get('BillingItemSaveButton').setDisabled(false);
},
failure: function (result, request) {
Ext.Msg.alert('Error!', 'There was a problem while saving the Billing Item. Please check your input and try again.');
Ext.ComponentManager.get('BillingItemSaveButton').setDisabled(false);
}
});
但是请求被发送到服务器 TWICE。
-点击事件肯定只被触发一次!
- 如果我手动浏览到 strURL 中的 URL,服务器端函数只会触发一次,所以它似乎不是服务器端的任何东西。
但是(除了url相同)应用程序中其他地方的ajax请求只触发一次,我看不出有任何区别!
我该如何去追踪这个?