Damian
Damian

Reputation: 1720

Another jQuery mobile redirect

I have a site that uses the odd header() PHP command after a form submit to redirect to another page. jQuery mobile does the redirect no problem and shows the correct page.

What it doesn't do is update the 'data-role="page"' div; it only seems to update anything inside the 'data-role="content"' div. This has the effect of confusing the site as to where it is. If I hit refresh on the redirected page (page 2), I end up getting the page with the form reloaded (page 1).

After much searching, I've figured out if I use 'data-ajax="false"' on the form, this fixes the problem. Question is, is this the best way to do it or is there a way to perform a redirect while staying within ajax? Can I change the header() to something else more jQuery mobile/ajax friendly?

Upvotes: 1

Views: 1119

Answers (1)

Aaron
Aaron

Reputation: 14019

The only way besides ajax false that I know to fix this is to add data-url='redirect_url_here' to the div with data-role='page'.

Upvotes: 2

Related Questions