Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stephen on Dec 02, 2009 01:43
open dhtmlx forum
dhtmlxAjax and IE7 does not work

Problem with

function outputResponse(loader){
if(loader.xmlDoc.responseXML!=null)

If no XML returned then
1 statement is false in FF 3.5 - correct
2 statement is true in IE7 - incorrect

Reproduce:
1 run sample "Sending GET/POST request with dhtmlxAjax" click GET/POST buttons and repeat with SYNC checkbox ticked
2 remove file process.php and run sample again and notice
a) FF3.5 response is
i) popup = Request Sent
ii) popup = Response contains no XML
a) IE7 response is
i) popup = Request Sent
ii) popup = We Got Response



Answer posted by Alex (support) on Dec 02, 2009 02:29

You can try to use the following check:

function outputResponse(loader){
 if(loader.xmlDoc.status==404) alert("the xml file isn't found");
 ...
}

Answer posted by Stephen on Dec 02, 2009 06:57
Hi, thanks yes I had realised these checks would work
if (loader.xmlDoc.status==200) alert(XML found");
if (loader.xmlDoc.status==404) alert("XML not found");
or
if (loader.xmlDoc.statusText=='OK') alert("XML found");
if (loader.xmlDoc.status=='Not Found') alert("XML not found");

just pointing out that sample check
if(loader.xmlDoc.responseXML!=null)
would not work for IE
Answer posted by Stephen on Dec 03, 2009 01:01
What conditional do you recommend for both ie a test that works for both FF and IE?
 
1) for FF use if(loader.xmlDoc.responseXML!=null) XML found
2) for IE7 use  if(loader.xmlDoc.status!=404) XML found
but
check 1 only works for FF not IE7 ie always true for IE7 ie responseXML!=null always
check 2 only works for IE7 not FF ie always true for FF ie status==200 statusText=Ok always

Answer posted by Alex (support) on Dec 03, 2009 02:29

Probably the following one:

if(loader.xmlDoc.status!=404 &&loader.xmlDoc.responseXML!=null){

    /*your code here*/

}

Answer posted by Stephen on Dec 03, 2009 02:45
Ok combine the two checks IE && FF
This seems to work for both: if (loader.xmlDoc.responseText!="") // XML rcvd