|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
SitePoint Zealot
![]() ![]() Join Date: Mar 2006
Posts: 123
|
Simple if statement not working
I am using Prototype Ajax.Updater and am trying to read the response text but it doesn't seem to read. Here is a snippet of my code:
Code:
function showFormResponse(req)
{
var response = req.responseText;
$('message').innerHTML = req.responseText;
if(response == '1'){
alert('booh');
}
}
|
|
|
|
|
|
#2 |
|
SitePoint Zealot
![]() ![]() Join Date: May 2005
Posts: 174
|
Removes quotes
Use this statement if(response == 1) instead of if(response == '1') |
|
|
|
|
|
#3 |
|
SitePoint Zealot
![]() ![]() Join Date: Mar 2006
Posts: 123
|
Wow can't believe that did it. Thanks. I assumed that when I echo the response out in php as a string then it would come back the same.
|
|
|
|
|
|
#4 |
|
SitePoint Zealot
![]() ![]() Join Date: May 2005
Posts: 174
|
No Problem whatsoever
|
|
|
|
|
|
#5 |
|
SitePoint Zealot
![]() ![]() Join Date: Mar 2006
Posts: 123
|
Sajjad,
How come it doesn't want to match up strings? Why only integers? I've tried matching: "Loading..." both with single quotes and double quotes. The response is exactly the same, but won't go in the if. |
|
|
|
|
|
#6 |
|
SitePoint Zealot
![]() ![]() Join Date: May 2005
Posts: 174
|
the answer is in ur question find it???????
|
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 14:23.








Hybrid Mode
