On Mar 28, 2012, at 6:56 AM, weheh wrote: > Many thanks, Jonathan, Anthony. I didn't realize the HTTP return value (200 > vs. 300 etc.) might actually make a difference in the execution of the > Location argument. Again, I must go back and look even more closely at the > HTTP source and auth source. It's always a balance between slogging through > the source or throwing a slow pitch out to you guys, who routinely hit the > ball out of the park.
Well, the whole Ajax business gives me a headache. At any rate, as Anthony points out, you need to tailor your redirection request to its intended audience, and in this context passing the new location to your JavaScript is likely to make more sense. web2py's ajax() function ultimately makes its request with jQuery.ajax(), which is making the http request and (I assume) handling 30x redirects. You *could* use HTTP(200, Location=URL(...)), but then your JavaScript code would have to check the returned headers and do the redirection itself, and it doesn't look like ajax() has hooks for that; you'd have to call jQuery.ajax yourself. I think. So the question is whether you want the browser to load the new URL as a page, or you want the new URL to be the real reply to the ajax() call. I think. > > On Wednesday, March 28, 2012 9:32:45 PM UTC+8, Jonathan Lundell wrote: > On Mar 28, 2012, at 6:18 AM, weheh wrote: >> I don't understand why HTTP(200,Location=URL(...)) isn't redirecting to >> URL(...)? > > Shouldn't you be using a 30x response here? > >> >> >> On Wednesday, March 28, 2012 12:01:05 PM UTC+8, weheh wrote: >> I'm trying to figure out how the proper syntax to redirect from an ajax call >> using HTTP(200,Location=URL(...)). >> >> The problem is the ajax call points to either an id or an :eval. But I want >> to refresh the entire page -- wiping the slate clean. Is this possible? >

