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

Closed
pfenig opened this Issue Oct 21, 2011 · 3 comments

Comments

Projects
None yet
2 participants
@pfenig

pfenig 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

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender Oct 21, 2011

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.

Contributor

johnbender commented Oct 21, 2011

@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.

@pfenig

This comment has been minimized.

Show comment Hide comment
@pfenig

pfenig 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.

pfenig 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

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender Oct 21, 2011

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"

Contributor

johnbender commented Oct 21, 2011

@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"

@johnbender johnbender closed this Oct 21, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment