tags:

views:

97

answers:

2

I'm using the following piece of code to pull a stock price from yahoo finance

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

I get the following errors:-

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

and

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

Source File: [url]

anybody have any thoughts as to how i might get around this?

+1  A: 

The JavaScript security model doesn't allow you to load off-domain content. There's a good explanation of this and some work-arounds on the jQuery .getJSON docs: http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback

Nolte Burke
A: 

See this which details how to use YQL to get jsonp results back from yahoo services

redsquare