Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Ajax navigation on form submit does not mimic normal navigation bar behavior if there's a redirect #2785

Closed
sfenig opened this issue Oct 21, 2011 · 3 comments

Comments

@sfenig
Copy link

sfenig commented Oct 21, 2011

When a form is submitted via Ajax, jQM updates the navigation bar with form's action rather than the resulting url in the case of a redirect. i.e if you post to /things and redirect to /things/1 on a successful post, the resulting page is /things/1 but the navigation bar says /things. xjjk has graciously offered a simple test case, which he will add to the comments soon.

@johnbender
Copy link
Contributor

@pfenig,

You should be able to set the page element's data-url attribute to the new relative url (in this case /things/1). See the nav documentation under Data-url Storage.

@sfenig
Copy link
Author

sfenig commented Oct 21, 2011

@johnbender,

Thanks, I did just realize that would do it, not so bad. It still seems to me though that we wouldn't want the default behavior to mimic the browser, and then data-url should be an override in case we don't want the standard.

@johnbender
Copy link
Contributor

@pfenig,

We can't do that. Browser's follow redirects without alerting the xhr object so we have no way of knowing if there was in fact a redirect:

http://www.w3.org/TR/XMLHttpRequest/#infrastructure-for-the-send-method

[edit] that's the next version of xhr, the current one http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070618/ has the spec we're looking for. You can find it by searching for "If the response is an HTTP redirect"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants