JQuery ajax request returns error and status 0
- by Kucebe
I use this pseudo-class to make ajax request to server:
function RequestManager(url, params, success, error){
//save this ajax configuration
this._ajaxCall = null;
this._url= url;
this._type = params.type;
this._timer = params.timer || 0;
this._success = function(){
alert("ok");
};
this._error = function(){
alert("ko");
};
}
RequestManager.prototype = {
require : function(tag){//here there will be a tag object in array format
if(this.timer>0){
//wait this.timer
}
if(this.ajaxCall != null ){
this.ajaxCall.abort();
this.ajaxCall = null;
}
var self = this;
this.ajaxCall = $.ajax({
url: this._url,
type: this._type,
data: tag,
success: function(xmlResponse){
var responseArray = [];
var response = _extractElements(xmlResponse, arrayResponse);
self._success(response);
},
error: self._error,
complete : function(xhr, statusText){
alert(xhr.status);
return null;
}
});
}
When i instantiate a new object, and i use it to load a request, it always return to me error, and status code is 0.
Server correctly generates an xml document.
Why i can't get a correct 200 code back?