The ? value is used as a shortcut that tells jQuery to call the function that is passed as a
parameter of the getJSON() function. You could replace the ? with the name of another function
if you do not want to use this shortcut.
Below, I am pulling into a Web page, using the Flickr JSONP API, the most recent photos
tagged with “resig.” Notice that I am u sing the ? shortcut so jQuery will simply call the callback
function I provided the getJSON() function. The parameter passed to the callback function is
the JSON data requested.
Sample: sample100.html
Notes:
Make sure you check the API of the service you are using for the correct usage of the
callback. As an example, Flickr uses the name jsoncallback=? whereas Yahoo! and Digg use
the name callback=?.
Stop a browser from caching XHR requests
When doing an XHR request, Internet Explorer will cache the response. If the response contains
static content with a long shelf life, caching may be a good thing. However, if the content being
requested is dynamic and could change by the second, you will want to make sure that the
request is not cached by the browser. One possible solution is to append a unique query string
value to the end of the URL. This will ensure that for each request the browser is requesting a
unique URL.
// Add unique query string at end of the URL.
url:'some?nocache='+(new Date()).getTime()
100