When making an ajax request, are there problems if user reload page right away?

Asked

Viewed 54 times

0

Hello, I’m developing a PHP system where it works with IPTV lists stored in services like Pastebin. The user submits such a url, for example (https://gitlab.com/bieldry02/FilmeseSeries.m3u8/raw/master/FilmeseSeries.m3u8), in a form and my script will analyze line by line the contents of the list. 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. Except that as the server may take time to respond, the user can continue browsing the site, my big doubt is that when the server sends the response to the request there will be some problem.

Adding more information:

It is a site that has a user panel, I want to give the freedom to submit such a list and while the server does not send the reply, it continue browsing normally on the site.

  • It depends on how the page navigation is done. Can you explain more about the page you have? it’s all loaded at once or it’s dynamic?

  • The page loads at once.

1 answer

2

Hello @Marcos Silva,

Uses the ajax beforeSend() when the list is loading, keeps the user informed that this is happening through a buffer/preloader, and it would be relevant to leave the user focused on this request made by himself not letting him click other buttons during this process, then in Success Function(), you get the result as soon as the list is definitely loaded, and release it to continue browsing 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;
  • But I want to give the freedom of the user to submit such a list and while the server does not send the answer, it continues browsing normally on the site.

  • If the user reloads the entire page via http, the list will start loading again from scratch. So you need to organize this structure in a dynamic way. *Let’s imagine that you have a menu with several links/buttons, then each link should be loaded with ajax, and each content should be loaded in different Ivs, so you get the desired result. $(". list"). load("folder/list.php"); $(". content2"). load("folder/content2.php");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.