开发者

PHP instantiation breaks the script with AJAX call

I called a PHP script with jQuery but it doesn't return any response if i instantiate a class before echo-ing the response. Meaning that it works if i instantiate the object after.

javascript code :

$.post('libraries/test.php', {action: 'duplicateForm', service: service_name}, function(response)
{
    console.log(response);
});

php script:

$response = '1';
$f = new u开发者_开发技巧svn_form_insert();
$response = '2';
echo $response;

I don't use the $_POST variables in this test. With this, the response is empty but if I put the echo before $f = new usvn_form_insert(); it prints 1


Put error_reporting(E_ALL) at the top of your php script and see if it returning any error back to the browser.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜