In order to make an ajax call for google finance api

If you copy and skip the following URL in your browser: http://finance.google.com/finance/info?client=ig&q=MUTF_CA%3ATDB900

it displays a string without any problems. (this is what I wanted to get from the next ajax call)

But if I do the following:

  this.getQuote = function() {
    $.get('http://finance.google.com/finance/info?client=ig&q=MUTF_CA%3ATDB900', callback);
  }

  var callback = function(data){
    alert(data);
  }

He gave me the "Internal Server Error 500". I checked using firebug console. Did I do something wrong in ajax call?

Thank.

+3
source share
1 answer

As Shadow_boi already suggested, the problem is related to the same origin policy , which always applies to ajax requests. To fix the problem, you need to use JSONP .

: http://jsfiddle.net/cb9c3/

+2

All Articles