如何打印ajax出错原因,ajax总是会出错

我现在正试图学习使用ajax,但遗憾的是我无法将其发送到success。

$('.engineering-services').live('click', function() {

$.ajax({

url: 'index.php?route=information/information/homepage_info',

type: 'post',

data: {info_description : 'test'},

dataType: 'json',

success: function(json){

alert('pass');

},

error: function(json) {

alert('fail');

}

});

});

这是php函数......

public function homepage_info() {

$json = array();

if (isset($this->request->post['info_description'])) {

echo $this->request->post['info_description'];

echo '
test2';

}

$this->response->setOutput(json_encode($json));

}

然而,这总是会发出失败警报而不是通过警报。

我错过了一些明显的东西吗?

编辑:它发现函数正常,就像在控制台中它给出正确的响应一样,

即。

测试

TEST2

谢谢