Saturday, 10 March 2018

How to set response time when called from jquery to invoke server side action

$.ajax({
    url: "test.html",
    timeout: 3000,
    error: function(){
        //do something
    },
    success: function(){
        //do something
    }
});
In ajax call do not have any default timeout for request processing and return the 
response. 
In above example, i have set timeout of 3 sec. If the server return response within 3 sec
then success function will be executed otherwise throws error of timeout and error fuction
will be executed.

No comments:

Post a Comment