Register - How to refresh in JQuery/PHP?

12th of February 2014 2

How to refresh in JQuery/PHP?

I am making a site where you can post to walls. I need to update the wall posts without clicking refresh and changing the page location.

Best answer:

Answer by Ratchetr
First, you probably shouldn’t call it a wall, or you might be hearing from Facebook’s lawyers. Wall is a registered trademark of Facebook, when used in this context (first link).

You will need to do an Ajax callback from your page periodically to get the updated posts. This is fairly easy to do on the client side with JQuery. Create a timer (setInterval should work). When timer expires, make a $ .ajax call to a PHP page that returns the new content. When the ajax call completes, update your HTML content (see second link for the basic idea).

The tricky part is making sure you don’t overload your server. If you have a lot of users, all those ajax calls can overload your server if you aren’t careful. You have to be able to determine very quickly if there is any new content for the user (there probably won’t be on most calls).

What do you think? Answer below!

Filed under § jquery — Tagged with , ,

Share it!

Was it good for you to?


Support for the site!

No sponsors at the moment.

2 great comment(s) for this post

  1. maitrik 5:06 pm 12/02 of 2014

    You can use JQuery ajax get() function on perticular event. Go to this link for further details.

  2. Imam Andi Bastian 5:29 pm 12/02 of 2014

    you can use “load” after post, such as :

    $ (“#your_id”).load(“file name”);


Your opinion matters. Add it below.

Tip: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent comments


Copyright since 2010. All rights reserved. Design and the Absolute Theme by Tommie Hansen.