SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Addict goldensona's Avatar
    Join Date
    Jun 2011
    Posts
    226
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to refresh page using jquery ajax?

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

  2. #2
    SitePoint Enthusiast iMeow's Avatar
    Join Date
    Jan 2010
    Location
    Pretoria, South Africa
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You will need a PHP script to return a certain value which will listened for by your jQuery code.

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

    Code JavaScript:
    $.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?

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,047
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    The implementation is going to vary greatly based on the specifics of your situation.
    The only code I hate more than my own is everyone else's.

  4. #4
    SitePoint Addict goldensona's Avatar
    Join Date
    Jun 2011
    Posts
    226
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi Thanks for your reply.

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

  5. #5
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Are you perhaps after window.location.reload ?
    https://developer.mozilla.org/en/win...cation#Methods
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  6. #6
    SitePoint Addict goldensona's Avatar
    Join Date
    Jun 2011
    Posts
    226
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    thanks i want to refresh but it doesn't show explicit like ajax refresh

  7. #7
    SitePoint Addict goldensona's Avatar
    Join Date
    Jun 2011
    Posts
    226
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i have used meta refresh ,it show to user page refresh , i want with explicitly show to the user, but page should refresh periodically

  8. #8
    SitePoint Enthusiast iMeow's Avatar
    Join Date
    Jan 2010
    Location
    Pretoria, South Africa
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by goldensona View Post
    Hi Thanks for your reply.

    i want to refresh page without getting any input from any page. but using ajax without load page
    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.

  9. #9
    SitePoint Addict goldensona's Avatar
    Join Date
    Jun 2011
    Posts
    226
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by iMeow View Post
    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?

  10. #10
    SitePoint Enthusiast iMeow's Avatar
    Join Date
    Jan 2010
    Location
    Pretoria, South Africa
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by goldensona View Post
    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)?

  11. #11
    SitePoint Addict goldensona's Avatar
    Join Date
    Jun 2011
    Posts
    226
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    yes absolutely please give me solution to this

  12. #12
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    336
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Google is your friend:
    Google

    First link:
    JQuery- Auto Refresh Div Every X Seconds

  13. #13
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,047
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by goldensona
    yes absolutely please give me solution to this
    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.
    The only code I hate more than my own is everyone else's.

  14. #14
    SitePoint Addict goldensona's Avatar
    Join Date
    Jun 2011
    Posts
    226
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by centered effect View Post
    Google is your friend:
    Google

    First link:
    JQuery- Auto Refresh Div Every X Seconds
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •