0

AJAX 在成功时返回整个 html 页面而不是实际数据。

这是JS代码 -

<script>
window.fbAsyncInit = function() {
 FB.init({appId: '**********', status: true, cookie: true,xfbml: true});
FB.getLoginStatus(function(o) { 
if (!o && o.status) return;
if (o.status == 'connected') {
document.write("<php echo "connected" ?>");
} else if (o.status == 'not_authorized') {
document.write("<?php echo "unauthorized" ?>");
} else {
document.write("<php echo "loggedOut" ?>");
} 
});
 };

(function() {
 var e = document.createElement('script'); 
e.async = true;e.src = document.location.protocol +'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>

我需要的只是打印在页面上的数据,例如“已连接”、“未经授权”、“已注销”。

4

0 回答 0