jQuery.getJSON( url, [data], [callback] ) -


For all,

I would like to recover the exchange rate from Google with $ $ .getJSON I'm trying). Using the request: " http://www.google.com/ig/calculator?hl=en&q=1USD=?CAD "

returns a simple JSON file Is: {lhs: "1 US Dollar", rhs: "1.03800015 Canadian Dollar", Error: "", ICC: True}

I have been using the following jQuery function Canadian dollar amount:

  $ (document) .ready (function () {$ .getJSON ("http://www.google.com/ig/calculator?hl=en& Q = 1USD =? Cad? And label = ras & amp; format = jsn and jasonsoleback =? ", Function (data) {warning (data);});}); & Lt; / Script & gt;  

The fire bug displays the correct JSON file, but there is no invalid label used in it.

Any help is appreciated.

Bob

Google returns pure JSON and does not support JSONP ( = Colon wrapped in a callback).

JSONP looks:

  callback function ({json_object: "some_data"})  

Browser JSONP-data from other domains Can load as it can load javascript net JSON data in script-tags from other domains can not be executed as javascript and that is why it has not loaded it from other domains within script-tags can go.

In this particular case Google can get JSON on iGoogle using simple AJAX (because it is the same domain), but you can not request it from within your browser from within the browser. However, you can ask it on your server, work with results and send it to the customer (your server is acting as a proxy).


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -