$.post("result.php", {
name: vname,
email: vemail
}, function(response, status){
// Required Callback Function
});
I hav this code, and I just want to add a timeout of 10 seconds, should the user network is down I should alert "check ur internet connections". I do not want to use $.ajax
You can use a full $.ajax()
call and provide the timeout
property:
$.ajax({
url: 'result.php',
timeout: 10000,
data: {
name: vname,
email: vemail
},
success: function(response) {
// Required Callback Function
}
});
Alternatively you can use $.ajaxSetup()
to affect all AJAX calls in the current scope:
$.ajaxSetup({
timeout: 10000
});
$.post("result.php", { name: vname, email: vemail }, function(response, status) {
// Required Callback Function
});
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