Is there a way to set the timeout period in $.get()
?
As I want my script to give a warning that loading is taking some time (perhaps due to a busy server or whatever) Can't seem to find it anywhere..
Just use $.ajax(...)
:
$.ajax({
url: url,
success: function(data){
//...
},
timeout: 1000 //in milliseconds
});
Also as stated below in the comments you can use .ajaxSetup(...)
to apply the timeout globally:
$.ajaxSetup({timeout:1000}); //in milliseconds
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