Thread:BryghtShadow/@comment-3974211-20140403033113/@comment-1694864-20140411211153

With pure JS, we end up doing: // For older browsers with lack of Object.keys if (!Object.keys) { Object.keys = function (object) { var keys = []; for (var key in object) { if (object.hasOwnProperty(key)) { keys.push(key); } } } } $.getJSON('http://leagueoflegends.wikia.com/api.php?action=query&format=json', {   //indexpageids: '', // Object.keys    titles: 'File:SonaSquare.png',    prop: 'imageinfo',    iilimit: 1,    iiprop: 'url', }).done(function(data) {    mw.log('API result:', data);    // undefined checks omitted for brevity    var query = data.query;    var id = Object.keys(query.pages)[0]; // Because titles only has one name.    var url = query.pages[id].imageinfo[0].url;    // Do something with url    alert('URL:', url); }).fail(function(error) {    mw.log('API failed:', error); });