PHP header() and jquery mobile

11,263

Solution 1

try to add data-ajax="false" when you call that page, before redirecting using php header()

Solution 2

That code sends a 302 redirect header to the user's browser, instructing it to redirect to the provided URL. It should work. Have you checked the syntax? Information here: http://www.php.net/manual/en/function.header.php

Share:
11,263
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    I would like to use a php header('Location: newpage.php') to redirect.

    I got no error, but Jquery mobile seems to fail loading the destination page and the address bar stays with the old address.

    Do you have an advice please ?

    Thanks!

  • Cymbals
    Cymbals over 12 years
    It has nothing to do with ajax. The php header location should be called before any html.
  • Admin
    Admin over 12 years
    You are right Cymbals but thanks to Wenkhairu I have remember that I used to put data-ajax="false" on all my FORM in jquery mobile site, I had just forgot to put on this one...
  • Erdal G.
    Erdal G. almost 10 years
    Actually it does, as jQM changes all <a> call to XHR, and then parses the response. This means that it depends on your navigator's behavior. But since then, in 2014 now looks like to be ok everywhere :)