2013-05-31

Nginx 499 error code and AJAX termination

Views: 23500 | Add Comments

In a recent project, we encounter strange Nginx 499 error code problem. The web page bind an event handler to an “a” tag, which invoke an AJAX operation, as shown below

<a class="mybutton">Click Me</a>

$('a.mybutton').click(function(){
    // ajax
});

The code works fine on most browsers, but doesn’t work on an embed web browser widget. I finally found out that it was an IE6 bug. The browser widget terminates the AJAX request after click event handler ends. To prevent this, you must return false in the event handler

<a class="mybutton">Click Me</a>

$('a.mybutton').click(function(){
    // ajax
    return false;
});
Posted by ideawu at 2013-05-31 10:35:14 Tags: , ,

Leave a Comment