1

Using jQuery mobile, loading pages (internal pages) should be done by using an AJAX Request to load the document into the DOM.

While an AJAX request is running (long-taking action on an SAP Server - Webservice) the application should stay responsive to the user. When the request finishes a message should be displayed.

This all works fine, except: When a user changes the page while the request is running, the request gets aborted.

Is there anything I can do to solve this problem? Might be related to this problem: Change page in the middle of Ajax request

Community
  • 1
  • 1

1 Answers1

0

Maybe you should set a variable that indicates the status of your request and prevent user from leaving the page when the request is running . e.g. $('a').click(function(){ return !running;})

Nick Shvelidze
  • 1,564
  • 1
  • 14
  • 28
  • The answer has some problems. 1) It is `onbeforeunload`. 2) Your code can just be `return !running;` 3) You cannot prevent user from leaving the page. If anything is returned from `onbeforeunload` then user is asked if he wants to leave the page and the returned value is written in that dialog. – kubetz Dec 13 '11 at 12:22