在发送数据时我遇到了一点问题:为什么Ajax会返回ParseError?我不知道为什么......任何帮助都将不胜感激。
function redeem_all_pts(co_id) {
var path = base_url+"cmaster/redeem_all";
$.ajax({
type:'POST',
url:path,
data:'co_id='+co_id,
dataType:'json',
success: function(resp) {
console.log("success!!="+resp);
},
error:function(resp, error) {
console.log(error);
}
});
}
我的PHP函数是:
public function redeem_all() {
$user_id = $this->session->userdata('user_id');
if (!empty($user_id)) {
$co_id = $this->input->post('co_id');
$this->db->set('co_ytd_points','0', false);
$this->db->where('co_id' , $co_id);
} else {
$this->load->view('pages/login');
}
}
当我在Google Chrome上调试代码时,具体的错误信息如下:
resp = Object {readyState: 4, responseText: "", status: 200, statusText: "OK"}, error = "parsererror"