升级到 jQuery 1.5.2 后,在返回 json 数据时,我的 ajax 调用开始出现问题。
错误是(由下面的 templateGet() 返回):
Ajax 调用失败:[object Object] parsererror jQuery152040843801534161517_1302269320612 未被调用
下面是一个示例返回 json:
{"subject":"Test subject","body":"Test body"}
继承人的jQuery函数
function ajax_templateGet(templateid) {
showLoading();
var query = '?action=get_template' + '&templateid=' + templateid;
$.ajax({
type: 'POST',
url: 'script/ajax/mail_template/mail_template.ashx' + query,
data: '',
dataType: 'json',
success: function(data) {
$("#preview_subject").empty().html(data.subject);
$("#preview_body").empty().html(data.body);
},
error: function(xhr, status, error) {
$.jGrowl($.i18n._('Ajax call failed: ' + xhr + ' ' + status + " " + error), { header: $.i18n._('Ajax call failed!') });
},
complete: function(jqXHR, textStatus) {
hideLoading();
}
});
}
任何人都可以看到我做错了什么?