私のコードは最初の数分間は機能しますが、ページがクラッシュするか、その後は機能しません。コンテンツを「未定義」にする必要がある場所も時々表示されますが、コードの何が問題なのですか?
$(document).ready(function(){
test();
});
function test(){
$.getJSON("http://graph.facebook.com/http://xzenweb.co.uk?callback=?",
function(data) {
var name = data["shares"];
var dataString = 'shares='+name;
$.ajax({
type: "POST",
url: "index.php",
data: dataString,
cache: false,
success: function(html)
{
$("#content").html(html);
}
});
return false;
});
setTimeout("test()",5000);
}
phpコード:
if(isset($_POST["shares"])) {
echo $_POST["shares"];
}