Didn"t forge 2016-05-26 08:34 采纳率: 25%
浏览 4

AJAX重复通话

This question has been answered many times but Those can not help me out. I have tried to do AJAX call from a form but some reason it called double time.

var requestVendor = false;
$("#vendor").change(function() {
    var value = $("#vendor option:selected").val(); 

    var courseURL = host.concat("/admin/getcourse");


    if (requestVendor !=true) {
        $.ajax({
            type: "POST",
            url: courseURL,
            data: {"id": value},
            success: function (response) {
                // done something here 
                requestVendor = true;
            }
        });
    }
});

enter image description here

How to prevent that duplicate call. It's driving me crazy right now.

  • 写回答

1条回答 默认 最新

  • weixin_33713503 2016-05-26 09:34
    关注

    I think it may be duplicate js(jquery.validate.unobtrusive.js) you are using in your project or you can check it out to comment it if you are using.

    Hope it will help.

    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统