Widget:Sandbox2: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
function test(){ | function test(){ | ||
alert("boop"); | alert("boop"); | ||
$.getJSON("http://www.wikidoc.org/api.php?action=query&meta=siteinfo&siprop=statistics&format=json",function(data) | $.getJSON("http://www.wikidoc.org/api.php?action=query&meta=siteinfo&siprop=statistics&format=json",function(data) { | ||
{ | var items = []; | ||
} | $.each(data, function(key, val) { | ||
); | items.push('<li id="' + key + '">' + val + '</li>'); | ||
} | }); | ||
$('<ul/>', { | |||
'class': 'my-new-list', | |||
html: items.join('') | |||
}).appendTo('output'); | |||
}); | |||
</script> | </script> | ||
<form> | <form> | ||
<input type="button" onclick="test()" value="Push me!" /> </form> | <input type="button" onclick="test()" value="Push me!" /> | ||
<div name="output" id="output"> </div> | |||
</form> | |||
</includeonly> | </includeonly> |