<html><title>FreeNATS API JavaScript</title> <body> <script type="text/javascript"> function HandleData(data) { document.write("<pre>"); if (data[0].length>0) // data[0] is the query[0] result array for alerts { document.write("There are alerts\n"); } else document.write("There are no alerts\n"); document.write("\nStatus for Node Queried in Q1\n"); for (i=0; i<data[1].length; i++) { document.write(data[1][i][0]+"="+data[1][i][1]+"\n"); } document.write("</pre>"); } // Now Build the URL var url="http://FREENATS_URL/api.php?mode=js"; url=url+"&apikey="; url=url+"&query[0]=alerts"; url=url+"&query[1]=node"; url=url+"¶m[1]=bob"; url=url+"&callback=HandleData"; document.write(url+"\n"); var output="<script src=\""; output=output+url; output=output+"\" "; output=output+"type=\""; output=output+"text/javascript\""; output=output+">"; document.write(output); </script>