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 :
- No effect after removing exit function.
- No space before php and ajax decalration.
- Firebug says " nothing".
- Tried in all browsers.