2009-06-26 68 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: *');