Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #23754
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: xhr call and changing page |
| Date | 2014-03-31 19:23 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <4186496.FSMyk1E8Y6@PointedEars.de> (permalink) |
| References | <YeKdnX0JJb6iW6XOnZ2dnUVZ_sidnZ2d@westnet.com.au> |
Andrew Poulos wrote: > When I send some data using AJAX to the server (to save to a db) and > then immediately navigate to a new page what seems to be happening is > that no data gets to the db. > > Does changing the page that made the AJAX call cause the call to get > cancelled? Obviously, as always (and please don't say “AJAX call”). You need to avoid the race condition by not navigating before you are sure the request has been sent; even better, wait until the response has been received. > I'm trying to track an elearning course. When the user closes the window > containing the course I have a loop in the parent page that checks for > the course's window. A loop? > If the window cannot be found it updates the server with the "logout" time > and then navigates to the course selection page. Also consider listening to events pertaining to navigating away/closing the window. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
xhr call and changing page Andrew Poulos <ap_prog@hotmail.com> - 2014-03-31 12:33 +1100 Re: xhr call and changing page Denis McMahon <denismfmcmahon@gmail.com> - 2014-03-31 02:35 +0000 Re: xhr call and changing page Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-31 19:23 +0200 Re: xhr call and changing page Danny <dann90038@gmail.com> - 2014-03-31 11:48 -0700
csiph-web