I have code like that
var ajaxrequest = $.ajax({
type: "POST",
dataType: "json",
url: "xy.php",
data: {
action : "read"
}
}).fail(function(){
//something to do when ajaxreq fails
}).done(function(data){
//something to do when ajaxreq is done
});
It is working no problem. My question is why this doesnt work:
var ajaxrequest = $.ajax({
type: "POST",
dataType: "json",
url: "n3_vaje_api.php", //Relative or absolute path to response.php file
data: {
action : "read",
},
fail:function(){
//something to do when ajaxreq fails
},
done:function(data){
//something to do when ajaxreq is done
}
});
Fail and done are just examples, complete also doesnt work if used inside. But using it outside like:
ajaxrequest.complete(f(){});
is working just fine... I know instead of done I should use success, but thats not my point here.
Whats the deal here?