Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>An AJAX request (XMLHttpRequest) is probably the way to go.</p> <p>I have a very simple example of an XMLHttpRequest (with Java as the backend) here: <a href="https://stackoverflow.com/a/18028943/1468130">https://stackoverflow.com/a/18028943/1468130</a></p> <p>You could recreate a backend to receive HTTP GET requests in any other server-side language. Just echo back whatever data you retrieved, and <code>xmlhttp.onload()</code> will catch it.</p> <p>Depending on how complex your data is, you may want to find a JSON library for your server-side language of choice, and serialize your data to JSON before echoing it back to your JS. Then you can use JavaScript's <code>JSON.parse()</code> method to convert your server data to an object that can easily be used by the client script.</p> <p>If you are using jQuery, it handles AJAX very smoothly, and using <code>$.ajax()</code> would probably be easier than plain-old XMLHttpRequest.</p> <p><a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow noreferrer">http://api.jquery.com/jQuery.ajax/</a> (There are examples throughout this page, mostly-concentrated at the bottom.)</p> <p>It really annoys me how complicated so many of the AJAX tutorials are. At least with jQuery, it's pretty easy.</p> <p>Basically, you just need to ask a script for something (initiate the request, send url parameters), and wait for the script to give you something back (trigger your <code>onload()</code> or <code>jqxhr.done()</code> functions, supplying those functions with a <code>data</code> parameter).</p> <hr> <p>For your other questions:</p> <ul> <li>Use JavaScript's <code>setTimeout()</code> or <code>setInterval()</code> to initiate an AJAX request every 600000 milliseconds. In the request's <code>onload</code> callback, handle your data and update the page appropriately.</li> <li>The response will be asynchronous.</li> <li>This isn't a socket.</li> <li>"Pushing" probably isn't the way to go in this case.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload