나는 아규먼트과 같이 받아들이는 PHP 페이지를 만들 싶습니다PHP 스크립트
http://localhost/page.php?topic=Foo
을 한 후 자동으로 다음 SQL 데이터베이스에서 데이터를 가져옵니다 곳 주제 = 푸하지만, 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 비트를 할 수있는, 그것의 단지 문제를 갖는 response.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>
그게 고장났다. 여기에 귀하의 시도를 게시 할 수 있습니까? – karim79
그리고 지금까지 시도한 것은 작동하지 않습니까? –
@karim 게시물을 업데이트했습니다. –