我正在尝试编写API调用其命中数据库但在此代码中回调操作调用多次所以请尝试理解我的问题 在下面的代码不能正常工作,请更正
$(document).ready(function() {
// reject article requests start
var article;
$(".resend-article-request").click(function() {
var articleId = $(this).attr("data-article-id");
article = articleId;
$("#articleRejectModal").foundation('open');
});
$(".editingReasons").click(function() {
var formData = new FormData($('#articleEditForm')[0]);
formData.append('articleId', article)
var articleReviewCallBacks = {
"success": function(data) {
$('#articleEditForm')[0].reset();
alert("Sending for Re-Write article.");
window.location.reload();
},
"error": function(data) {
alert("error");
window.location.reload();
}
};
window.pmprojectutils.getResponse('POST', '/api/article/rewrite', formData, articleReviewCallBacks, true);
})
});