/ Published in: JavaScript

Using JSON-P with jQuery. Note the callback.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$.getJSON("http://example.com/chats.json?callback=?", function(data){ $.each(data.chats, function(i,chat){ alert(chat.body); }); });
URL: http://actsasflinn.com/2008/06/13/cross-domain-restful-json-p-with-rails#jsonpwithjquery
Comments
