Reputation: 13
Sorry maybe this question is stupid (alert should be put in $.post's callback), but it's really confusing.
The following js code runs fine in FireFox, but cause Chrome hangs everytime.
$.post("main.php");
alert('hello');
The 'main.php' is just as simple as:
<?php
echo 0;
?>
It works very well on FireFox(an alert window pops up immediately), while causes Google Chrome hangs for a quite long time (browser hanging for more than 20minutes and nothing shows at all).
If I change "alert('hello');" to "console.log('hay, I am back!');", however, it works for both FireFox and Chrome everytime.
Any suggestions are welcome!
Upvotes: 1
Views: 761
Reputation: 4463
Why don't you try your POST
request like this:
$.post('main.php',{},function(response)
{
alert("Success Yo!");
console.log(response); //check if you're getting the correct response from server
}).error(function(){
alert("Oops error");
});
Upvotes: 1