I am converting dojo to jquery ajax,dojo can get the result but ajax can't here are the codes comparision:
dojo:
var getResourceHandler = dojo.xhrPost( {
url: feedUrl,
content: {
nlsStringKey: key
},
sync: true,
handleAs: "json",
preventCache: false,
load: function(data){
console.debug(data);
resourceList = data;
},
error: function(error){
console.debug("getNlsStringFromFeed ERROR");
console.debug(error);
}
})
and here is the code of jquery ajax
var getResourceHandler = $.ajax({
method: "POST",
url: feedUrl,
data: { nlsStringKey : key },
dataType:"json",
cache:true
});
getResourceHandler.done(function(data){
console.debug(data);
resourceList = data;
});
getResourceHandler.fail(function(error){
console.debug("getNlsStringFromFeed ERROR");
console.debug(error);
});
so ajax didn't get the result, resourceList = null by the end. but dojo got the result, resourceList is not null. couldn't figure out the problem.
Thank you in advance.