We are using the same URL as before to fetch the data, but we have added the
jsonp parameter and are setting it to
getRedditData; it is important to note that the feed is now padded into our callback
getRedditData. Now let's replace the URL property in our earlier script to create a new script that will fetch us the JSON feed.
A few properties such as
dataType have been modified and a few new properties such as
jsonpCallback have been added. We have already discussed the change in the
url property, so let us look at the other properties.
dataType property was set to
json as the incoming feed was of type
json, but now the JSON feed is being padded into a callback, and it has to be switched so that the browser expects a callback rather than JSON itself. The new properties that have been added are
jsonpCallback; the property
contentType specifies the type of content being sent to the web server.
jsonpCallback takes the name...