summaryrefslogtreecommitdiff
path: root/javascript/ajax.js
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/ajax.js')
-rwxr-xr-xjavascript/ajax.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/javascript/ajax.js b/javascript/ajax.js
new file mode 100755
index 0000000..7ccafe2
--- /dev/null
+++ b/javascript/ajax.js
@@ -0,0 +1,27 @@
+function ajax()
+{
+ var xhr=null;
+
+ xhr = new XMLHttpRequest();
+ //on définit l'appel de la fonction au retour serveur
+ xhr.onreadystatechange = function() { alert_ajax(xhr); };
+
+ xhr.open("GET", "streamstatus.php", true);
+ xhr.send(null);
+}
+
+function alert_ajax(xhr)
+{
+ if (xhr.readyState==4)
+ {
+ var docXML= xhr.responseXML;
+ var streamstatus = null;
+ var items = docXML.getElementsByTagName("streamstatus")
+
+ streamstatus = items.item(0).firstChild.data;
+ if ( streamstatus == 'error' )
+ this.location.href = 'error.php';
+ else
+ swapPic();
+ }
+}