将getJSON更改为JSONP

我有这个代码:

  $(document).ready(function() { $.getJSON('http://example.com/api/get_cats', function(fbResults) { document.write(fbResults.cats[0].title); }); });  

我该如何更改此代码:

  $(document).ready(function() { $.getJSON('http://example.com/api/get_cats', function(fbResults) { document.write(fbResults.cats[0].title); }); });  

它作为JSONP工作……这完全不同吗?

实际上,你只需添加?callback=? ,jQuery完成其余的工作。

 $(document).ready(function() { $.getJSON('http://example.com/api/get_cats?callback=?', function(fbResults) { document.write(fbResults.cats[0].title); }); });