views:

34

answers:

1

Hello,

I am trying to show server load on a web page. The server load is fetched in PHP by executing the shell command "/proc/loadavg" and displaying the output as it is.

However, I want to display the same output using Javascript (jQuery is fine) and have it updated every 10 seconds.

How do I do so? I was thinking of using Ajax query but I think that is overcomplicating things

+1  A: 

You have no choice but to set up something like an ajax mechanism. It doesn't have to be XMLHttpRequest but it has to be some explicit communication from the browser to a URL on your server.

Think about it: the Javascript is running inside a client browser. How is it going to get the load average of the server without actually communicating with the server?

Pointy
You're right. I did as you said and it worked - thanks! :)
aam1r