Unfortunately, there wasn’t a live demo you can play around with and see it work, and since the article was posted things might have changed and doing cross-domain HTTP requests are no longer a straightforward affair (at least not when it comes to Chrome and Firefox). If you had tried to piece together all the bits of code snippets from the article you might find that it only works in IE but not in Chrome or Firefox.
So I decided to put together a working demo, and with that, let’s start with the HTML from the original example:
Key things to note here:
- line 6, at the end of the url I added &callback=? which is the standard way to specify a JSONP callback with jQuery’s getJSON function.
- line 9, I used getJSONAsObservable, which is the same as getJSON but returns the values as an observable sequence