Skip to content
Snippets Groups Projects
Commit ae0b3bb0 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: ajout vérification sur la fonction loadXMLDoc

parent 7919085d
No related branches found
No related tags found
No related merge requests found
...@@ -262,8 +262,14 @@ function loadXMLDoc(url,readyStateFunction,async) ...@@ -262,8 +262,14 @@ function loadXMLDoc(url,readyStateFunction,async)
if (req.overrideMimeType) { if (req.overrideMimeType) {
req.overrideMimeType('text/xml'); req.overrideMimeType('text/xml');
} }
req.open("GET", url, async); if (req) {
req.send(null); if(readyStateFunction) req.onreadystatechange = readyStateFunction;
req.open("GET", url, async);
req.send(null);
} else {
alert('Cannot create XMLHTTP instance');
return false;
}
// branch for IE/Windows ActiveX version // branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) { } else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP"); req = new ActiveXObject("Microsoft.XMLHTTP");
...@@ -271,8 +277,7 @@ function loadXMLDoc(url,readyStateFunction,async) ...@@ -271,8 +277,7 @@ function loadXMLDoc(url,readyStateFunction,async)
if(readyStateFunction) req.onreadystatechange = readyStateFunction; if(readyStateFunction) req.onreadystatechange = readyStateFunction;
req.open("GET", url, async); req.open("GET", url, async);
req.send(); req.send();
} } else {
else {
alert('Cannot create XMLHTTP instance'); alert('Cannot create XMLHTTP instance');
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment