0

What is the right way to redirect between html documents generated with php with jquery mobile?

Standard header("Location:url") will add another jquery mobile page to html page and I have then issues with loading urls if script which generated webpage is in different folder

For example: /index.php have login form with attributes:

<form action="data/login.php" data-ajax="false" method="post">

After submitting data, login.php redirects me with header("Location:url"); to right page, but generated links on this followed page are "broken". They have new folder in filepath.

Example: I log-in a then want to redirect to /orders.php and then open 1st order on order.php?id=1.

I click submit to login form, /data/login.php redirects me to /orders.php, but if I click on link generated from orders.php to 1st order - order_detail.php?id=1 it won't load, because /orders.php has changed the link from /order_detail.php?id=1 into /data/order_detail.php?id=1.

James07
  • 293
  • 1
  • 5
  • 14

2 Answers2

0

You need to make your URLs absolute instead of relative. See https://stackoverflow.com/a/2005174/413531 for further info.

Community
  • 1
  • 1
Hirnhamster
  • 7,101
  • 8
  • 43
  • 73
0

You can try this

echo " window.location.replace(\"index.php\")";

Janey
  • 1,260
  • 3
  • 17
  • 39