我需要先在第1页上使用ajax发送我的值,然后从第2页开始

时间:2016-12-03 08:03:50

标签: php ajax

我正在尝试使用ajax从原始页面向第一页发送我的值,然后到第2页这是我的代码,但似乎无效。

这是原始页面上的代码,我只给出了脚本,因为我只是使用div的click事件来发送值

<script>
    function displayRecords(numRecords, pageNum,x,catg) {
        $.ajax({
            type: "GET",
            url: "button.php",
            data: {
                show:numRecords,
                pagenum:pageNum,
                val12:x,
                catg12:catg,
            },
            cache: false,
            success: function(data) {
                $("#tabs1-html").html(data);  
            }
        });
    }

    function changeDisplayRowCount(numRecords) {
        displayRecords(numRecords, 1);
    }

    $(document).ready(function() {
        $('.tab12').click(function(){
        var catg=$('#cat').val();
        var x =$(this).val();

        displayRecords(5,1,x,catg);
        });
    });
</script>

现在我的第1页上的代码

这里

<script type="text/javascript">
    function get_data(no,x,catg) {
        $.ajax({
            type:'post',
            url:'question_call.php',
            data:{
                row_no:no,
                X:x,
                category:catg,                                
            },
            success:function(response) {
                document.getElementById("pagination_div").innerHTML=response;
            }
        });
    }

    $(document).ready(function() {
        $('#tota_page_div').click(function(){
          var catg = $category.val();
          var x    = $X.val();       
          get_data(no,x,catg);
        });
    });
</script>

这些是我保存以前的值的值

$X        = $_GET['val12'];
$category = $_GET['catg12'];

现在,当我尝试在第2页上使用print_r时,它只显示row_no而不是catg12和val12

0 个答案:

没有答案
相关问题