On Wed, Aug 24, 2011 at 7:00 AM, Sreejith K. <sreejithk2000(a)gmail.com> wrote:
Hi,
We are trying to show the number of files in a Commons category[1] at a page
in meta[2], but we are not sure how to make interwiki calls as most
browsers block it.
* [1]
-
http://commons.wikimedia.org/wiki/Template:India_loves_Wikipedia_event
* [2]
-
http://meta.wikimedia.org/wiki/WikiConference_India_2011/Wiki_Outreach#Indi…
Any lead in this direction will be appreciated.
You can use JSONP with a URL like
http://commons.wikimedia.org/w/api.php?action=query&whatever=youneed&am…
. Or in jQuery AJAX that would be:
$.getJSON( 'http://commons.wikimedia.org/w/api.php?callback=?',
{'action': 'query', 'whatever': 'youneed',
'format': 'json' },
function( data ) { .... } );
jQuery automatically replaces the ? in callback=? with a randomly
generated function name and makes sure your callback is called.
Roan Kattouw (Catrope)