如果放入php并刷新,代码工作正常,但我想在点击div(比如#F1)时加载它。但是在通过jquery + json请求应用它时,它没有显示......这是
的代码//Loading On click Event
$('#F1').click(function(e)
{
//alert('1');
loadData3();
FB.XFBML.parse(document.getElementById('divfbcomment'));
});
//loadData3() definition
var loadData3 = function(){
var url = 'commenter.php';
$.getJSON(url, function(data) {
$('#levelsel').empty().append(data.selS);
$('#fbc').empty().append('<div class="fb-comments" id = "divfbcomment" data-href="mysite/comment/comment'+data.fbS+'" data-width="650" data-numposts="3" data-colorscheme="dark"></div>');
});
}
//Commenter.php
<?php
session_start();
//echo $_SESSION['level'];
$selstring='';
$selstring.='<select class="sel">';
for ($x=$_SESSION['level'];$x>0;$x--)
$selstring.='<option>Level '.$x.'</option>';
$selstring.='</select>';
$data=array();
$data=array(
'selS'=>$selstring,
'fbS'=>$_SESSION['level'],
);
echo json_encode($data);
?>
我的O / P如下
<div class="fb-comments" id="divfbcomment" data-href="mysite/comment/comment3" data-width="650" data-numposts="3" data-colorscheme="dark"></div>
它不会加载所需的文档......
很抱歉,如果它是重复的,我们没有得到所需的答案....