[英]jQuery sending out multiple of the same ajax calls
從C#我將以這種方式返回
return PartialView("~/View.cshtml", model);
看來,我正在以這種方式更新數據。 用這種方式綁定后,我多次收到請求。
$("#LoanCommitteDateSubmitedselected").change(function ()
{
$.ajax({
success: function (data)
{
$("#sectionName").html(data);
}
});
});
在以Ajax表單提交完成此操作后,我在以下方法中多次收到請求。
$('#sectionName').submit(function (e)
{
e.preventDefault();
$.ajax({
success: function (response)
{
}
});
});
有人可以建議我如何解決此問題嗎?
這可能與多個事件注冊有關。
您可以嘗試解除綁定,然后將提交功能綁定為-
$('#sectionName').off('submit');
$('#sectionName').on('submit',function (e)
{
e.preventDefault();
$.ajax({
success: function (response)
{
}
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.