I am writing an app using JQuery Mobile and PHP.
The problem: When I try to pass values from one JQuery mobile page (e.g. from #page1 to #page2 using Ajax and PHP) $_GET does not retrieve the values in the URL.
The url will look like this:
myApp/#page3?fid=Milk+Cheese+Butter
PHP is unable to get "?fid=".
I figure this is a problem with the way the URL is setup using JQuery mobile (single page). Any help resolving this problem would be greatly appreciated. Thank you
My Ajax (snippet):
request.onreadystatechange = function(){
if((request.readyState==4) && (request.status==200 || request.status == 304)) {
if(request.responseText!= undefined){
window.location.replace('#page3?fid='+request.responseText+'');
}
}
}
First PHP page:
<?php
include '../connect/connect.php';
$ingredients = $_POST['ingredients'];
if (empty ($ingredients) === false){
foreach($ingredients as $key => $ingre){
if ($ingre != 'undefined'){
$refine = substr($ingre, "4");
$refined = mysqli_real_escape_string($con, $refine);
echo $refined;
}
}
}
?>
Second PHP page:
<?php
if (isset($_GET['fid'])) {
echo 'yes';
} else {
echo 'no';
}
?>
myApp/?fid=Milk+Cheese+Butter#page3