CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    2

    Question 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:
    Code:
    echo $retvalue;
    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.

  2. #2
    Join Date
    Oct 2009
    Posts
    2

    Resolved 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
  •  





Click Here to Expand Forum to Full Width

Featured