繁体   English   中英

jQuery发送多个相同的ajax调用

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM