Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #23754

Re: xhr call and changing page

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: xhr call and changing page
Date Mon, 31 Mar 2014 19:23:51 +0200
Organization PointedEars Software (PES)
Lines 30
Message-ID <4186496.FSMyk1E8Y6@PointedEars.de> (permalink)
References <YeKdnX0JJb6iW6XOnZ2dnUVZ_sidnZ2d@westnet.com.au>
Reply-To Thomas 'PointedEars' Lahn <usenet@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1396286633 3101 eJwNxcEBwCAIA8CVjJCI4yCV/Uew9zmaoFouytls7XMxlTM/XqBytBc90k4rdkh/DpovDKvzABv2EKA= (31 Mar 2014 17:23:53 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Mon, 31 Mar 2014 17:23:53 +0000 (UTC)
User-Agent KNode/4.11.5
X-User-ID eJwFwYEBgDAIA7CXxLbIzgEG/59gIrh5f3Q5tVqPsaeJHMoBbT68uRpPncpiFyzfpnqDQt1rwamKA4z0A12GFeY=
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Cancel-Lock sha1:w6PUOFdDWGw7caXFsAWKJ8N3jB8=
X-NNTP-Posting-Host eJwNyckBwDAIA7CVoGCnjBOu/Udo9RWMyjpO0LFYz5t0H7y0OzvyNNqk4nQwS6BiAf9Lt3r6AySxEb0=
Xref csiph.com comp.lang.javascript:23754

Show key headers only | View raw


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


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