2009-06-26 110 views
0

我使用下面的代碼段拉股價從雅虎財經跨域腳本錯誤?

<script type="text/javascript"> 
$(function() { 
    $("#quote").load("http://finance.yahoo.com/q?s=utg #yfs_l10_utg").text(); 
}); 
</script> 

我得到以下錯誤: -

Security Error: Content at file:[file url] may not load data from http://finance.yahoo.com/q?s=utg. 

Error: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "[file url]"] 

源文件:[url]

任何人有任何想法,我可能會如何在這附近?

回答

0

this詳細介紹瞭如何使用YQL從雅虎的服務獲得JSONP結果返回

0

我知道這並不能幫助你的情況,但把它放在這裏,對於任何未來的用戶來說,都會遇到這種情況

如果您有權訪問目標URL服務,請在PHP中添加以下代碼片段以避免此錯誤。

header('Access-Control-Allow-Origin: *');