Difference between revisions of "Sandbox"
From Organic Design wiki
m |
|||
Line 2: | Line 2: | ||
<input id="param1" /> | <input id="param1" /> | ||
<input id="param2" /> | <input id="param2" /> | ||
− | <button id="send-email" value= "Send" /> | + | <input type="button" id="send-email" value="Send" /> |
+ | <script> | ||
$('#send-email').click(function() { | $('#send-email').click(function() { | ||
var param1 = $('#param1').val(); | var param1 = $('#param1').val(); | ||
var ask = '{{#ask:[[Category:' + param1 + ']]|link=none|sep=<br>|limit=500}}'; | var ask = '{{#ask:[[Category:' + param1 + ']]|link=none|sep=<br>|limit=500}}'; | ||
− | console.log(ask); | + | console.log('Sending query: ' + ask); |
+ | $.ajax({ | ||
+ | type: 'post', | ||
+ | url: mw.util.wikiScript('api'), | ||
+ | dataType: 'json', | ||
+ | data: { | ||
+ | action: 'parse', | ||
+ | text: ask, | ||
+ | contentmodel: 'wikitext' | ||
+ | }, | ||
+ | success: function(json) { | ||
+ | console.log(json); | ||
+ | } | ||
+ | }); | ||
}); | }); | ||
+ | </script> | ||
</html> | </html> | ||
− |
Revision as of 22:14, 3 February 2018