gpt4 book ai didi

jquery - Facebook阻止了我的JSON请求

转载 作者:行者123 更新时间:2023-12-03 08:08:08 25 4
gpt4 key购买 nike

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Doers Inc | The one who does something</title>
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(function () {
$.ajax({
url: "http://query.yahooapis.com/v1/public/yql",
dataType: "jsonp",
success: function (data) {
console.log(data.query.results.json);
$.each(data.query.results.json.entries, function (i, v) {
$('#entries').append(data.query.results.json.entries[i].content + '<br />');
});
}, data: {
q: 'select * from json where url="https://www.facebook.com/feeds/page.php?id=397319800348866&format=json"',
format: "json"
}
});
});
});


</script>
</head>
<body>
<div id="entries"></div>
</body>
</html>​

我使用上面的代码使用json + jquery来获取我的Facebook帖子。但是当我将代码添加到站点 here中的html文件中时,输出显示
​ 

sign.this代码是什么问题或任何问题?

最佳答案

这些字符不是来自facebook,它们在您的代码中。哪些破坏了您的JavaScript。

修复代码后,它在这里工作:
http://jsfiddle.net/KubtF/

查看源代码:http://doers.lk/post.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Doers Inc | The one who does something</title>

<script src="http://code.jquery.com/jquery-1.8.3.js"></script>


<script type="text/javascript">
$(document).ready(function(){
$(function () {
$.ajax({
url: "http://query.yahooapis.com/v1/public/yql",
dataType: "jsonp",
success: function (data) {
console.log(data.query.results.json);
$.each(data.query.results.json.entries, function (i, v) {
$('#entries').append(data.query.results.json.entries[i].content + '<br />');
});
}, data: {
q: 'select * from json where url="https://www.facebook.com/feeds/page.php?id=397319800348866&format=json"',
format: "json"
}
});
});
​
​ });
</script>


</head>
<body>

<div id="entries"></div>​



</body>
</html>

关于jquery - Facebook阻止了我的JSON请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13952429/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com