Category Archives: jQuery Faq
Refresh page using jQuery
Refresh page using jQuery : There are many ways to refresh a page using jQuery. You can use location.reload(). Here in this tutorial we are going to explain some of common used methods to reload the page in jQuery. We will explain this with example and demo.
Refresh page using jQuery
You use the following methods to refresh the page in jQuery –
Method 1 : Using location.reload()
You can use location.reload() to refresh a page. Here is an example-
If You run the above example it will produce output something like this-
Method 2 : Using history.go(0)
You can use history.go(0) to refresh a page. Here is an example-
If You run the above example it will produce output something like this-
jQuery Abort Ajax Request
jQuery Abort Ajax Request – abort() is used to cancel the ajax request. abort() method cancels the requests that has been already sent. Here in this tutorial we are going to explain how you can use abort() method to cancel the ajax request in jQuery.
jQuery Abort Ajax Request : Kill / Cancel Ajax Request
You can cancel the ajax request simply using the abort() method as below –
jQuery Abort Ajax Request : Cancel Ajax Request Example
var ajaxReq = $.ajax({ type: "POST", url: "server.php", data: "email=kelly@yopmail.com&phone=123", success: function(data){ alert( data ); } }); //Now cancel the ajax request ajaxReq.abort(); |
The above example shows a sample ajax request. ajaxReq.abort(); will kill the current ajax request. You can use this function to cancel the ajax requests which has been sent.