Why jquery.ajax very slow in navigating to other page

I have jquery.ajax that requesting some records to my database.,the problem is if it is always requesting data,and tried to click some navigation menu,It can’t navigate to other page it is very slow.when I tried to comment the method inside my success,it works fine I can navigate because there is no request pending but how can I make this work to request then I can navigate.

Thank you in advance.

  $(function(){
      Updates();

  });


   function Updates(){
           type: "GET",
           dataType:'json',
           url: "updates.php",
           error: function () {
               setTimeout(Updates, 5000);
           },
           success: function(data){
              //do something with the data
              ...
              ...
              ...
               Updates(); //call again the function

           }

       });

    }

Maybe if the server is responding too fast so you are overloading the net with the updates packets…

You could try to set an onClick event on the menu that set off a flag so your ajax bucle stops in the moment that somebody clicks it… so it could be something like this:

  var cont = true;
  $(function(){
      Updates();
      $("#someMenu").click(function() {
            continue = false;
      });
  });


   function Updates(){
           type: "GET",
           dataType:'json',
           url: "updates.php",
           error: function () {
               setTimeout(Updates, 5000);
           },
           success: function(data){
              //do something with the data
              ...
              ...
              ...
              if(cont)
                  Updates(); //call again the function

           }

       });

Thank you for the reply…I found out that my php script that takes so long to query.