jemz — 2013-07-12T17:09:58-04:00 — #1
Hi, I am almost 4 hours debugging in this string,i could not compare this ..
it always goes to my else statement but when i try to alert it is "success" but why it did not go to the if statement.please help me on this
Thank you in advance.
if( data == "success")
alert(data + 'problem');
paul_wilkins — 2013-07-12T17:32:36-04:00 — #2
What is the length of data? Is it more than 7 characters?
jemz — 2013-07-12T17:42:43-04:00 — #3
Yes, more than 7 ...i tried to alert(data.length)...why is it more than 7?it should be 7 characters.
jeff_mott — 2013-07-12T18:09:22-04:00 — #4
Try console.log instead of alert. data might not be a string.
EDIT: And continue to follow up with paul_wilkins's thought process. Seems there might be some whitespace characters in there. A newline maybe?
jemz — 2013-07-12T18:26:46-04:00 — #5
I already, tried console.log "success" but it always falls to else statement...I am confuse with this...
jemz — 2013-07-12T18:32:29-04:00 — #6
is there other way to check if this string contains whitespace or something...?
jemz — 2013-07-12T18:39:19-04:00 — #7
I tried to use indexOf('\s')>=0 then it alerted..so it means has whitespace,... but i check this where it came from it has no whitespace.
return "success" this is the string,i tried to retype.but it always fall to else statement....
paul_wilkins — 2013-07-12T18:56:17-04:00 — #8
If it comes from a PHP file, does the PHP file end with ?> followed by a newline? Anything after the ?> will be output too.
jemz — 2013-07-12T19:11:23-04:00 — #9
Whoooo....thank you so much paul_wilkins...you solved my problem...now i know that if we put whitespace on this ?> end tag it will also output.