I have two ajax based methods which are executing after each 10 seconds. But I have one more thing which is form submission. Right now when I submit the form to process then it's wait for previous triggered ajax calls to complete and then processing. I would like to prioritize it.
Following script I have
function refresh_ss_one(){
$.ajax({
type: 'GET',
url: "{{ route('RefreshSessionOne') }}",
data: {},
success: function(response){
console.log(response);
}
});
}
function refresh_ss_two(){
$.ajax({
type: 'GET',
url: "{{ route('RefreshSessionTwo') }}",
data: {},
success: function(response){
console.log(response);
}
});
}
setInterval(refresh_ss_one, 10000);
setInterval(refresh_ss_two, 10000);
I have one more which is executing on form submit event and I would like to prioritize it. I have gone through async
ajax parameters and used in my ajax function but still facing the issue.
$("#check-rate").submit(function(e) {
var form_data = $(this);
$.ajax({
type: 'POST',
url: currency_route,
data: form_data.serialize(),
success: function(response)
{
...
}
});
e.preventDefault();
});
Can someone kindly guide me how can I fix this issue..