PHP$_GET不适用于JQuery Mobile


PHP $_GET not working with JQuery Mobile

我正在使用JQuery Mobile和PHP编写一个应用程序。

问题是:当我尝试从一个JQuery移动页面(例如,使用Ajax和PHP从#page1到#page2)传递值时,$_GET不会检索URL中的值。

网址如下:

myApp/#page3?fid=牛奶+奶酪+黄油

PHP无法获取"?fid="

我认为这是使用JQuerymobile(单页)设置URL的方式的问题。如果能为解决这个问题提供任何帮助,我们将不胜感激。谢谢

我的Ajax(片段):

request.onreadystatechange = function(){
    if((request.readyState==4) && (request.status==200 || request.status == 304)) {
        if(request.responseText!= undefined){
            window.location.replace('#page3?fid='+request.responseText+'');
        }
    }
}  

第一个PHP页面:

<?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;
            }
        }
    }
?>

第二个PHP页面:

<?php
    if (isset($_GET['fid'])) {
         echo 'yes';
    } else {
        echo 'no';
    }
 ?>

哈希(从#字符开始的所有内容)不会发送到服务器。散列应该在url的末尾,在所谓的查询字符串之后,所以正确的url应该是:

myApp/?fid=Milk+Cheese+Butter#page3