Ajax response creating problem

Discussion in 'JavaScript' started by computerzworld, Mar 7, 2009.

  1. #1
    Hello,
    I am using ajax function for retrieving values from database. But in the response an extra blank line( \n ) comes. Here is my javascript which calls ajax.

    
    var response = callInquiryAJAX('<?=base_url()?>inquiry/checkInquiry/inquiryHistoryId/'+recordIdStr1);
    
    Code (markup):
    And here is my ajax function which is called in order to retrieve data from php.

    
    function callInquiryAJAX(url) 
    {
          try 
          {
            req = new XMLHttpRequest(); /* e.g. Firefox */
          } 
          catch(e) 
          {
              try 
              {
                  req = new ActiveXObject("Msxml2.XMLHTTP");
       /* some versions IE */
              } 
              catch (e)
              {
                  try 
                  {
                      req = new ActiveXObject("Microsoft.XMLHTTP");
      /* some versions IE */
                  } 
                  catch (E) 
                  {
                     req = false;
                  }
              }
         }
    
    //      req.onreadystatechange = function() {responseInquiryAJAX(pageElement);};
           req.open("GET",url,false);
          
          
          req.send(null);
          if(req.readyState == 4) 
          {
             if(req.status == 200) 
             {
                      return req.responseText;
             }
          }
    }
    
    Code (markup):
    I am unable to trace why it is giving such kind of output. I have checked PHP code as well as javascript code. There is nothing that is creating extra line. Please help me. Thanks in advance.
     
    computerzworld, Mar 7, 2009 IP