Reputation: 145
I have a problem with my jquery ajax on chrome. Ajax will echo result like this:
1||result goes here
Here is the ajax script:
$("#load_cards").click(function() {
$("#load_cards").fadeOut('fast');
var form_data = {
query: 'cardpack',
page: page,
pack: pack
};
$.ajax({
type: "POST",
url: 'ajax.php',
data: form_data,
success: function(response)
{
response_d = response.split("||");
response_message = parseInt(response_d[0]);
response_html = response_d[1];
if (response_message == 1) {
hist = $("#card_pack_list").html();
$("#card_pack_list").html(hist+response_html);
page = page+1;
}
else {
}
$("#load_cards").fadeIn('fast');
}
});
});
The problem is that firefox and opera recognizes response_message as 1 but chrome does not. Why is that and how can i overcome it? I am running the script on xampp virtual server.
Upvotes: 1
Views: 1278
Reputation: 404
Are you sure that Chrome goes in "success" callback ?
If not, try to add "complete" and "error" callback to the ajax call and see what happened :
success: function(response) {
console.log("success callback");
...
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("error callback : " + textStatus);
},
complete: function(jqXHR, textStatus) {
console.log("complete callback : " + textStatus);
}
Upvotes: 1