How to refresh page using jquery ajax?

Hi i want to reload page using ajax or jquery can anyone please suggestion or give example

You will need a PHP script to return a certain value which will listened for by your jQuery code.


// do some check here to determine whether or not to refresh the page.
echo 'refresh';


$.ajax({
  url: 'http://example.com/refresh.php',
  success: function(data) {
    if (data == "refresh"){
      window.location.reload(); // This is not jQuery but simple plain ol' JS
    }
  }
});

Is this what you wanted?

The implementation is going to vary greatly based on the specifics of your situation.

Hi Thanks for your reply.

i want to refresh page without getting any input from any page. but using ajax without load page

Are you perhaps after window.location.reload ?
https://developer.mozilla.org/en/window.location#Methods

thanks i want to refresh but it doesn’t show explicit like ajax refresh

i have used meta refresh ,it show to user page refresh , i want with explicitly show to the user, but page should refresh periodically

Huh? Could you start from the beginning and explain exactly what you wish to accomplish? I fail to see how AJAX, JavaScript, jQuery and meta refresh tags have anything to do with each other.

now i m using meta refresh tag , this is annoying when user see the page, so i want to refresh without know to user. like ajax update . is any solution?

Oh, so you don’t want to refresh the page but simply change/refresh the content of the page (at a set interval)?

yes absolutely please give me solution to this

Google is your friend:
Google

First link:
JQuery- Auto Refresh Div Every X Seconds

Your specifications are way to broad. You need to provide details in regards to what data on the page needs to change and preferably a link to the page in question. Only then are you going to receive any useful answers regarding your specific situation.

i want the whole page refresh using jquery ajax. is any example?

if i used meta refresh,that refresh was visible to me, i want ajax refresh for whole page.