Ajax is not able to get the proper response

I am using an AJAX call to to get the response from the server. I can see that in our logs, server is responding the proper data, eg:

" <xmltag> " + result + " </xmltag>"

After we get the result we are using below snippet:

if (null != result && result.indexOf('<xmltag>') > -1) {
    var temp = result.split(' ');
    ppdTime = temp[1];
}

Most of the time (almost 99%) it works fine. We have started noticing that few instances we are not able to get the proper response even when we can see that server did responded with valid data.

Please not that we are using JavaScript http_request = new XMLHttpRequest(); to send and receive the request.

Did anyone come across this kind of issue? Can this be possible that split(' ') won't work in some browsers?

Can it possible that indexof can fail in case of some OS/browser combinations?

Below are the user agent we have received in case of failures.

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) --- IE8 XP

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB7.5; InfoPath.3; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.4506.2152; .NET4.0C; .NET4.0E; IPH 1.1.21.4019; BRI/2) --IE7 XP Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; MS-RTC LM 8) IE8 Windows7

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0) IE9 Windows 7

Mozilla/5.0 (iPad; CPU OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53 Safari 7 iOS 7 Tablet

链接地址: http://www.djcxy.com/p/51918.html

上一篇: 介绍Js不适用于IE8。 有没有解决方法?

下一篇: Ajax无法获得正确的响应