-10

In my php

$t_keyword= $_GET['user']; in setting file

I want to use in http://www.domain.com/index.php?user="Roni" after run above url ajax not work but if I set in setting file $t_keyword= 'roni'; its work

how to work http://www.domain.com/index.php?user="Roni"

my code index.php

<?php require 'settings.php'; ?>
<html>
    <head>
        <title></title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <style type="text/css">
        #fetched-torrents span{float: left;height:20px;}
        #fetched-torrents div span:nth-child(even){background: #c0c0c0;}
        #fetched-torrents div{float:left; clear: both;}
        .t-link{width: 100px; overflow: hidden;}
        .t-name{width: 300px; overflow: hidden;}
        .t-size{width: 150px; overflow: hidden; text-align: right;}
        .t-se{width: 110px; overflow: hidden; text-align: right;}
        .t-le{width: 110px; overflow: hidden; text-align: right;}
        .t-ve{width: 100px; overflow: hidden; color: green;}
        </style>
    </head>
    <body>
        <script type="text/javascript">
        function search(){
            $.ajax({
                url: 'search.php',
                beforeSend: function(jqXHR){
                    $('#status').html('<img src="images/loading.gif" width="16" height="16" alt="+" />');
                },
                success: function(data){
                    if(data.error!=undefined){
                        $('#status').html(data.error);
                        return;
                    }
                    $('#status').html('');
                    var t_displayed=0;
                    for(var x in data){
                        if(data[x].ver==0){
                            continue;
                        }
                        if(t_displayed>=t_max){
                            break;
                        }
                        t_displayed++;
                        $('#fetched-torrents').append('\
                            <div>\
                                <span class="t-link"><a href="'+data[x].hhss+'">a</a></span>\
                                <span class="t-name">'+data[x].saas+'</span>\
                                <span class="t-size"> '+bytesToSize(data[x].ssa, 2)+'</span>\
                                <span class="t-ss">'+data[x].sff+'</span>\
                                <span class="t-lss">'+data[x].dff+'</span>\
                                <span class="t-ves">Veris</span>\
                            </div>\
                        ');
                    }

                },
                dataType: 'JSON'
            });
        }
        var t_max=<?php echo $t_max;?>;
        $(function(){
            search();
        });
        </script>
        <div id="status"></div>
        <div id="fetched"></div>
    </body>
</html>
4

1 回答 1

1

在网址后添加后我的问题解决了:)

        $.ajax({
            url: 'search.php',
            data: 'user=<?php echo $keyword;?>',
于 2012-06-09T05:52:45.687 回答