I have the following Ajax request that is supposed to retrieve some data to insert inside a div:
$.ajax({
url: "work/mywork.php",
data: { data_string: JSON.stringify({pages_count: 2, page: 1}) },
method: "GET",
complete: function (response) {
$("#slider").append(response.responseText);
$("#slider").css({width:(2*100)+'%'});
register_visualizers();
pages_count = 2;
low_end = 0;
high_end = 1;
},
error: function(jqHXR,textStatus,errorThrown){
console.log(errorThrown);
}
});
But if it somehow fails to retrieve such data, it redirects me to work/mywork.php. I believe it has something to do with headers, but I don't know how to avoid such header being set or if It's something completly different.
I would appreciate some insight on this, I've already search the web for about 2 days and I coulnd't find anything usefull.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire