JQuery Page Refresh

JQuery Page Refresh

Here we will see how to refresh page using JQuery. On button click we can refresh the page or timely call the function which refresh the page. location.reload(); is used to do the task.

Note: location.reload(); function generates new request to all resources like CSS, external JavaScript and page. It doesn’t refer the resources from browser cache.

Example

<html>
<
head>
<
title>Jquery Hello World Example</title>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript">
</
script>

<script type="text/javascript" language="javascript">

$("document").ready(function(){

$("#Button1").click(function(){

location.reload();

}); });

</script> </head> <body>

<div id="content"> <input id="Button1" type="button" value="Reload Page." /> </div>

</body> </html>

Description

In above example, once document is ready that means all elements are loaded in browser we are attaching click event to button. location.reload(); method actually generates page request.

Tags:

Jquery

Jquery Animate On Page LoadLearning JqueryBasics of jqueryJQuery Page TransitionJQuery SlideJquery Trim StringJQuery Animate Div Height and WidthGoogle JQuery CDNHow to call function in JQueryJquery Ajax TutorialAsp.net JQuery Calendar Control

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.