I have a some code that works perfectly in chrome, but it goes wrong in IE. The if condition works perfectly in chrome, but it seems like in IE the first condition is always executed regardless of the value of the resData. I wiresharked the response, and the packet contains ‘started’, but it still goes in the first if condition if(resData===’not runnin’).
$.get('/getOutputBuffer', function(resData){
if(resData === 'not running'){
$('#output').append('Executable not started<br>');
}
else{
$('#output').append('Executable started (Now listening)<br>');
if(resData !== 'no updates'){
$('#output').append('status is ' +resData);
}
}
});
Edit:
I have changed all the if condition with ” == ” .
After more debugging, it doesn’t always execute the first if condition, the ajax function seems to be the problem. It GETs the proper data value the first time it is executed after the page is loaded, but any other GET will give me the first value, even if in wireshark it shows the proper updated value.
Sounds like the infamous IE-AJAX caching problem. Here’s some info http://ajaxian.com/archives/ajax-ie-caching-issue but Google will probably provide you with some more. IE caches the responses, so I guess that’s why you’re getting the first response again and again. I’m a little bit confused because you see in Wireshark that the requests are being made, but try setting the URL to something like
'/getOutputBuffer?r=' + new Date().getTime()and see what happens.