When making a ajax request, are there problems if I reload the page immediately?

0

Hello, I'm developing a system in PHP where it works with lists of IPTV stored in services like pastebin. The user submits a url such as ( link ) in a form and my script will parse row by line of list contents. The problem is that the server takes too long to respond when the list is too large. So my idea is to make the request using ajax. But as the server may be slow to respond, the user can continue browsing the site, my big question is that if the server sends the response of the request there will be some problem.

Adding More Information:

It is a site that has a user panel, I want the freedom of it to be able to submit a list of these and as long as the server does not send the response, it continues to navigate normally in the site.     

asked by anonymous 10.07.2018 / 07:48

1 answer

2

Hello @Marcos Silva,

Using ajax's beforeSend (), when the list is loading, keeps the user informed that this is occurring through a buffer / preloader, and it would be relevant to leave the user focused on that request made by himself by not letting him click on other buttons during this process, then in success function (), you get the result as soon as the list is finally loaded, and releases it to continue navigation, thus leaving the other buttons available.

$.ajax({
    type: "GET",
    url: "pasta/",
    beforeSend: function(){

      //buffer preloader
      //bloqueia demais botoes

    },
   success: function( data ){
     setTimeout(function(){

       //carrega a lista completa(com paginação se possivel ou necessario)
       //desbloqueia demais botoes permitindo que o usuario continue sua navegação

     }, 2000);
   }
});

return false;
    
10.07.2018 / 14:15