blob: 74005cba1d74213fc2e63ab8da39d7ed7211cd7f (
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
28
29
30
31
32
33
34
35
36
37
|
function url2div(url,divid) {
var http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Abandon : Impossible de cr�er une instance XMLHTTP');
return false;
}
http_request.onreadystatechange = function(){
if (http_request.readyState == 4) {
if (http_request.status == 200) {
document.getElementById(divid).innerHTML = http_request.responseText;
} else {
document.getElementById(divid).innerHTML = "Un probl�me est survenu ...";
}
}
};
http_request.open('GET', url, true);
http_request.send(null);
}
|