Tuesday, September 4, 2012

JQuery/AJAX/IE - screen jumps to top of the page after an AJAX call

Internet Explorer will jump to the top of the page after an AJAX call. You need to add return false after the AJAX call function and it will solve the issue.


            $.ajax( {
                  type : 'GET',
                  url : 'Code/my_code.php?' + new Date().getTime(),
                  data : request_data,
                  success : function(response) {
                        if (response == 'success') {
                              //Do cool stuff
                        }
                        else{
                              alert(“Error”);
                        }
            }});
            return false;

Cheers!

No comments:

Post a Comment