我提到错误的代码如下:
var request = {
action: "coupg_subscribe_affiliate",
email: $('#affiliate_signup_email').val()
}
$.ajax({
type: "post",
dataType: "json",
url: coupg_ajax_object.ajax_url,
data: request,
success: function (e) {
if (e.status == 1) {
window.location = e.link;
}
else if (e.status == -1) {
alert('Unknown error has occured. Please notify administrator as soon as possible.\nError code: ' + e.error);
}
}
})
我在其他地方有完全相同的AJAX代码,它可以工作。这里,它给了我提到的错误。是什么原因引起了这个?
答案 0 :(得分:0)
您忘记了JSON对象后面的分号。
var request = {
action: "coupg_subscribe_affiliate",
email: $('#affiliate_signup_email').val()
};
最佳, AJ