I have some Javascript code that grabs data from a server in a jQuery ajax call, and it seems to always trigger the success callback, even when it didn’t get the proper data. The error callback never gets triggered as its supposed to. I want to set a time limit on the success so if the data isn’t grabbed quick enough, an error is thrown. How might I do this?
3
Answers
Did you tried function?
setTimeout();
Usage :
Set the
timeout
property on the object.In ajax: