JQuery: undo events when history: back?

I know this question may be too simple, but I have no idea how to solve it.

when I submit the form, I will disappear in the boot image. When the form submission is successful, the page redirects blabla ...

Now, when I click the BACK button in my browser and I visit the previous page with the form, the Download-image is still displayed.

How can I hide it again?

considers

+3
source share
4 answers

Assuming you submit this via ajax since you get the loading screen. Just attach the image to hide the success.

$.ajax({
  url: 'ajax/form.html',
  beforeSend: function() {
    $('.loadingImage').fadeIn("slow");
  }
  success: function() {
    $('.loadingImage').fadeOut("fast");
  };
});
0
source
+1

- , ?

$(document).ready(function() {
    $('.loadingImage').hide();
});

, , .

0
source

If you really submit the form, then yes, you are loading the page.

$(function(){
  $(window).unload(function(){
    $('.loadingImage').hide();
  });
});

This will hide it before you really leave the page.

0
source

Source: https://habr.com/ru/post/1763016/


All Articles