带有AJAX自动刷新参数的PHP脚本


PHP Script with Arguements to AJAX Auto Refresh

我想创建一个PHP页面,它接受如下参数:

http://localhost/page.php?主题= Foo

,然后从SQL数据库中提取数据,其中topic=Foo,但随后每10秒自动检查新数据并使用Ajax刷新DIV标记。我试过了,但都没用。任何帮助吗?

编辑:这里是我使用的代码:

<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
 ext = <?php $_GET[feedtitle] ?>
 $(document).ready(function() {
     $("#responsecontainer").load("response.php?ext=" + ext);
   var refreshId = setInterval(function() {
         $("#responsecontainer").load('response.php?ext=' + ext);
   }, 9000);
   $.ajaxSetup({ cache: false });
});
</script>
</head>
<body>
<div id="responsecontainer">
</div>
</body>

编辑:我可以做SQL位,这只是得到参数的响应。php我有问题。

编辑:我有新的代码,但它仍然不工作:

<html> 
<head> 
<script src="http://code.jquery.com/jquery-latest.js"></script> 
<script> 
function gup( name )
{  name = name.replace(/['[]/,"'''[").replace(/[']]/,"''']");
  var regexS = "[''?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null ) 
   return ""; 
 else    
   return results[1];
}
var feed = gup('f');
$(document).ready(function() { 
$("#responsecontainer").load("response.php?ext=" + feed); 
var refreshId = setInterval(function() { $("#responsecontainer").load('response.php?    ext=' + feed); }, 9000); 
$.ajaxSetup({ cache: false }); 
}); 
</script> 
</head> 
<body> 
<div id="responsecontainer"> 
</div> 
</body> 

所以,你需要获取转义URL参数,输出jquery $。Post函数's的结果数据,然后你只需要知道如何用jQuery Ajax刷新页面?然后做一个AJAX Div检索每60秒?

我希望这对你有帮助。