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;
}
});
}
});
How to prevent that duplicate call. It's driving me crazy right now.