I have an ajax call that fires multiple times but is called once.
function getManagers() {
alert('ajax called');
var jqxhr = $.ajax({
type:'POST',
url: '/Concessions/Ajax/Concession.asmx/Managers'
}).success(function(data) {
var options = '<option selected="selected" disabled="disabled">Select Manager</option>';
for (var i = 0; i < data.length; i++) {
options += '<option value="' + data[i].ManRef + '">' + data[i].Description + '</option>';
}
$('#Manager').html(options);
}).error(function(data) {
alert('error')
}).complete(function() {
alert('complete');
});
}
The function is called within my document ready function and I was hoping for a single call but it appears to call this several times any ideas?
is there any chance your script is being loaded 'n' number of times, n being the number of ajax requests made.
You can check for this by viewing page source and finding the script. I am pretty sure that the script is being loaded multiple times.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With