Skip to content Skip to sidebar Skip to footer

How To Compare Xmlhttp.responsetext?

my code- document.getElementById('lblmsg').innerHTML=xmlhttp.responseText; if(xmlhttp.responseText == 'Available') { d

Solution 1:

Well, that should work.

Are you sure that the response text is exactly Available? Try trimming the response like this:

if(xmlhttp.responseText.trim() == 'Available')

Do you have access to firebug? Try a console.log(xmlhttp) to find out the exact value of the responseText.


Solution 2:

After hours of searching I found this pitfall: http://www.vertstudios.com/blog/avoiding-ajax-newline-pitfall/

This solved everything without $.trim(). Somewhere in my included files was a lonely linebreak!


Post a Comment for "How To Compare Xmlhttp.responsetext?"