kelly
kelly

Reputation: 13

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

Upvotes: 1

Views: 100

Answers (1)

hvgotcodes
hvgotcodes

Reputation: 120318

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.

Upvotes: 1

Related Questions