0

i was just wondering what happens to the request that was sent to server when the ajax call hits the timeout? There is some data sent to server and that in turns calls other API and it takes some time to respond. in the ajax call we have set a timeout of 10 seconds. if the request does not respond by that time we show the error message. But what happens to the request in progress? will the ajax call ignore the response received after the timeout expires? Thanks

akr
  • 11
  • 3
  • within the timeout if response came then ok otherwise it will be ignored (actually not ingonred but ajax completed with error) – Alive to die - Anant Jun 15 '17 at 10:45
  • You can also abort the request after the timeout if you choose to (see https://stackoverflow.com/questions/446594/abort-ajax-requests-using-jquery ) but the best way in my personal opinion is to just ignore the responses – Nico Van Belle Jun 15 '17 at 10:49
  • There wouldn't be a response if it times out ... otherwise it would have been a successful request – charlietfl Jun 15 '17 at 10:58
  • So does this mean that the request that was sent to server is processed successfully but the response will be ignored because the ajax request has ended due to timeout reached? Am i right in this understanding? – akr Jun 19 '17 at 11:17

0 Answers0