summaryrefslogtreecommitdiff
path: root/javascript/ajax.js
blob: 7ccafe2f6dcdd9e82bfa22f7d0778f6d4c4cb11e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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();
	}
}