-
October 9th, 2009, 10:06 AM
#1
whitespace issue
Hi everyone,
I am a bit confused as to why this error is happening, but i will try to explain it as best i can, if i don't explain it well enough let me know and i will go over it again in more detail.
i am returning a value either numeric or a string from a db, something like this:
and the js i am using is this:
Code:
var xmlhttp;
function retvalfrmdb()
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="retvaluefromdb.php";
url=url+"?sid="+Math.random();
xmlhttp.onreadystatechange=stateChange;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function stateChangee()
{
if (xmlhttp.readyState==4)
{
//
if(xmlhttp.responseText == 1)
{
showProperty(resp,aid);
}else{
$(".someid").prepend(xmlhttp.responseText+"<br />");
}
}
}
The problem is that when i go ahead and try and use the xmlhttp.responseText to compare it, it adds a space at the end of everything either a number or a string. Wierdest error i have ever seen, my host uses php5.2.x i am unsure if that is the problem or not, any help with this would be great.
-
October 10th, 2009, 05:41 PM
#2
Re: whitespace issue
I fixed it myself by making the if statements use parsed numbers...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|