我必须每 10 分钟刷新一次网络服务,我尝试使用 setInterval 它对我不起作用。这是我的代码,
onActivate:function()
{
setInterval(onActivate(),6000);
Ext.Ajax.request({
method:'GET',
contentType:'application/json; charset=utf-8',
dataType:'json',
url:'myurl',
//timeout:6000,
disableCaching: false,
interval:6000,
reader: {
type: 'json',
totalProperty: 'totalcount',
rootProperty:'GetMobileOperatorListResult',
},
success:function(response,request)
{
var jsonarr = Ext.decode(response.responseText);
var len=jsonarr.GetMobileOperatorListResult.length;
console.log("length"+len);
for(var i=0;i<len;i++)
{
//Storing our values in Array
var st = {
'text':jsonarr.GetMobileOperatorListResult[i].Operator,
'value':jsonarr.GetMobileOperatorListResult[i].OperatorValue,
};
//Adding our array to LocalStore(localStorage)
var localStore = Ext.getStore('MobileStore');
localStore.add(st);
localStore.sync();
localStore.load();
}//for loop
console.log("operator value\t"+st.value);
localStore.getProxy().clear();
},