Tutorial :using ajax to call a url


I have a php script on my site (users_online.php) that shows how many people are connected to my server whenever the script is executed and I would like to display and update this information on my front page using javascript / ajax without refreshing the page is this possible ?

Thanks, Kelly


Yes, its certainly possible. You can use jquery or any of the other myriad of js libraries out there.

The process is

  1. fire an xml http request (XHR) with whichever library you choose.
  2. process the response (handle both success and failure)
  3. update your page by dynamically modifying the DOM with your results.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »