0

I seen a strange (space) before response I got from Ajax.response text. Each time i fire my Ajax it sends some variables and activates php script and returns a string as Ajax.response text.

After some tinkering i found that even if i echo "nothing" I get a space before this static string too. what can cause this strange thing to happen ?

Ajax declaration :

function ajaxObj(meth, url) {
var x = new XMLHttpRequest();
x.open(meth, url, true);
x.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
return x;
}
function ajaxReturn(x){
if(x.readyState === 4 && x.status === 200){
    return true;    
}
}

PHP script :

<?php
if (isset($_POST['pattern']))   
{     
echo "nothing" ;
exit();
}?>

My Observations :

  1. No effect after removing exit function.
  2. No space before php and ajax decalration.
  3. Firebug says " nothing".
  4. Tried in all browsers.
akash raigade
  • 132
  • 11

0 Answers0