jQuery AJAX running multiple times
Hi have a Button which I'm running a script on when a user clicks on it. The script does what it should however it's running several times, 12, sometimes it's just once
Why?
I get the alert just as many times.
$(document).on("click","#schedule",function(e){
RunScript();
})
function RunScript(){
alert('d');
if (Dep != '' && Arr != ''){
console.log("Started");
$.ajax({
method: "POST",
url: "scripts/insert.php",
dataType: "json",
data: { ..... }
})
.done(function( result ) {
console.log(result);
})
.fail(function(){
alert('OOPS');
console.log(arguments);
});
}