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


Groups > comp.lang.javascript > #17619

Re: ajax request with no response

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: ajax request with no response
Date 2012-12-09 01:17 +0100
Organization albasani.net
Message-ID <ka0lb7$32i$1@news.albasani.net> (permalink)
References <67WdnSfJBNQHTV7NnZ2dnUVZ_uGdnZ2d@westnet.com.au>

Show all headers | View raw


On 2012-12-09 00:43, Andrew Poulos wrote:
> If I'm sending some info to a server using ajax and the "success" server 
> action is to redirect to another page, do I need to worry about the 
> (lack of a) response that the original page is expecting?

If it's an XHR request, there will be no navigation, and you will stay
on the original page. The server can redirect to another location, but
most XHR implementations just transparently follow the redirect and use
whatever the redirect target sends as responseText/responseXml. (There
may be some restrictions to that, especially if the redirect target is
not from the same origin. I have never tested that.)

If you do want to navigate away from the original page, don't let the
server do the redirect. Let the server return the new location to your
script (in whatever format you usually use to communicate with the
server), and the script then sets location.href.

- stefan

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

ajax request with no response Andrew Poulos <ap_prog@hotmail.com> - 2012-12-09 10:43 +1100
  Re: ajax request with no response Stefan Weiss <krewecherl@gmail.com> - 2012-12-09 01:17 +0100
    Re: ajax request with no response JJ <jaejunks@glegooilma-swapit.com> - 2012-12-10 04:17 +0000
      Re: ajax request with no response Stefan Weiss <krewecherl@gmail.com> - 2012-12-10 11:03 +0100
        Re: ajax request with no response JJ <jaejunks@glegooilma-swapit.com> - 2012-12-11 11:06 +0000
  Re: ajax request with no response Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-09 19:51 +0100
    Re: ajax request with no response Andrew Poulos <ap_prog@hotmail.com> - 2012-12-10 08:17 +1100
      Re: ajax request with no response Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-10 00:25 +0100
      Re: ajax request with no response Stefan Weiss <krewecherl@gmail.com> - 2012-12-10 00:53 +0100

csiph-web