【发布时间】:2013-12-20 14:33:32
【问题描述】:
不,例如在下一个案例中
错误是 SyntaxError: Unexpected token b listados:229 为什么?
response = '{"name":"John"}';
var obj = jQuery.parseJSON(response);
$.ajax({
url:urlform,
dataType:'json',
type:'POST',
data:obj,
async: false,
contentType: 'application/json',
success: function(data) {
alert('ok');
},
error: function(jqXHR, textStatus, errorThrown){
console.log("Error... " + textStatus + " " + errorThrown);
},
});
});
为什么?
【问题讨论】:
-
您的服务器响应似乎不是有效的 JSON。你能把它扔掉吗?
标签: jquery ajax json zend-framework2