私のphpで
$t_keyword= $_GET['user'];
設定ファイル
上記のURLを実行した後、 http://www.domain.com/index.php? user = "Roni"で使用したいajaxは機能しませんが、設定ファイルで設定すると機能$t_keyword= 'roni';
します
働き方http://www.domain.com/index.php?user="Roni "
私のコード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>