0
從我的網站加載JSON訂閱源時遇到了一些麻煩。我開始認爲Feed本身有問題,因爲將地址插入各種不同的示例代碼塊似乎並不奏效。JSON無法加載
我試過下面的例子中,與「原產地空沒有被訪問控制允許來源允許」,試圖深鑽通過Chrome的JavaScript控制檯的錯誤時,不斷滿足。有任何想法嗎?
嘗試#1:
<script type="text/javascript">
$().ready(function(){
var url = 'http://www.solidverbal.com/category/clicks?feed=json';
$.get(url, function(data) {
// can use 'data' in here...
});
});
</script>
嘗試#2:
<script type="text/javascript">
$.ajax({
type: "POST",
url: "http://www.solidverbal.com/category/clicks?feed=json",
data: '{}', // your parameter goes here
contentType: "application/json; charset=utf-8",
dataType: "json",
processdata: true,
success: function (msg) {
loadDetails(msg.d); // msg.d contains the JSON data being returned
},
error: function (msg, error, obj) {
alert(msg.responseText);
}
});
function loadDetails(results) {
// depending on the data in the JSON object, you can access them using
// the syntax results.<propertyname> etc…
}
</script>
是solidverbal.com你的域名? – 2011-02-17 23:00:49