0

is there any method in JQuery or Javascript to prevent the page refresh (F5) and then update only some parts of the page with Ajax?

I tried the code below with no results.

 $(window).bind('beforeunload', function(event) {
    event.preventDefault();
    //My ajax refresh code
 });

Many thanks for your time.

wuase
  • 23
  • 6
  • check out : https://stackoverflow.com/questions/3527041/prevent-any-form-of-page-refresh-using-jquery-javascript – JonSG May 06 '18 at 16:15

1 Answers1

0

you can try this with below code:

$('.update').click(function () {
$.ajax({
url: "",
success: function (s, x) {
$('.yourupdatesection').html(s);
}
});
});

You can add update button in that section and then you will click on it and only that one part will update with ajax

Therichpost
  • 1,759
  • 2
  • 14
  • 19