0

$.ajax post and timeout when the action takes longer than 90 secs. Is there way to increase the timeout more than 90 secs. Success function is called if the action return before 90 secs.

I tried using timeout setting did not make any difference. This timeout works if it is less than 90 secs.

I also tried adding [AsyncTimeout(120000)] attribute to action "ActionName" mentioned in the jQuery below. Still get timeout after 90 secs.

Below is the $.ajax jQuery:

$.ajax({
      url: '@Url.Action("ActionName", "ControllerName")',
      data: $(form).serialize(),
      datatype: 'html',
      type: 'POST',
      success: function(result) {
        var $myDialog1 = $('<div></div>')
          .html("Successfully completed.")
          .dialog({
            autoOpen: false,
            modal: true,
            width: 400,
            closeOnEscape: false,
            title: "CONFIRMATION",
            buttons: {
              "OK": function() {
                $(this).dialog("close");
                $("#DivName").html(result);
              }
            }

          });        
        $myDialog1.dialog('open');
      }
  • are you sure the server side script is not timing out? – chiliNUT Feb 09 '16 at 20:45
  • No, the IIS continues to create the transactions even after ajax timeout.The XMLHTTPRequest.responseText returns "timeout" – Megha Gowder Feb 09 '16 at 20:47
  • You can set a timeout in jQuery using the timeout option, however, by default it is 0 so the problem is likely caused by your server stack, not jQuery or anything clientside. – Kevin B Feb 09 '16 at 20:48
  • server side session timeout is set to 180 minutes. Server side continues to run even after timeout. – Megha Gowder Feb 09 '16 at 20:51
  • Doesn't change my comment in any way shape or form. jQuery (and the XHR for most if not all browsers) doesn't impose a timeout by default. If the request is timing out in just 90 seconds, it isn't because of jQuery. Look elsewhere. – Kevin B Feb 09 '16 at 20:52
  • 1
    Possible duplicate of [Set timeout for ajax (jQuery)](http://stackoverflow.com/questions/5225597/set-timeout-for-ajax-jquery) – Matthew Verstraete Feb 09 '16 at 20:54
  • That's not a duplicate. – Kevin B Feb 09 '16 at 20:55
  • The first test you should do is trying two other browsers. If all three hit the same timeout, you instantly rule out the browser being the problem, leaving server stack. The only way this could be a jQuery problem is if you're using $.ajaxSetup somewhere and setting a default timeout yourself. – Kevin B Feb 09 '16 at 21:04
  • I have not set default timeout in ajaxSetup anywhere. That's the first thing I verified. What server side setting should I check if its not jQuery timeout issue. – Megha Gowder Feb 09 '16 at 21:25

0 Answers0