Difference between revisions of "Sandbox"
From Organic Design wiki
m |
|||
Line 1: | Line 1: | ||
<html> | <html> | ||
− | <input id="param1" | + | <input id="param1" value="JavaScript" /> |
− | |||
<input type="button" id="send-email" value="Send" /> | <input type="button" id="send-email" value="Send" /> | ||
<script> | <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= | + | var ask = '{{#ask:[[Category:' + param1 + ']]|link=none|sep=;|limit=500}}'; |
console.log('Sending query: ' + ask); | console.log('Sending query: ' + ask); | ||
+ | var title = mw.config.get('wgPageName'); | ||
+ | console.log(title); | ||
$.ajax({ | $.ajax({ | ||
type: 'post', | type: 'post', | ||
Line 15: | Line 16: | ||
action: 'parse', | action: 'parse', | ||
text: ask, | text: ask, | ||
− | contentmodel: 'wikitext' | + | contentmodel: 'wikitext', |
+ | format: 'json' | ||
}, | }, | ||
success: function(json) { | success: function(json) { | ||
− | + | var page = mw.config.get('wgPageName'); | |
+ | window.location = mw.util.wikiScript() + '?title=Special:EmailPage&ea-title=' + page + '&ea-to=' + json.parse.text; | ||
} | } | ||
}); | }); |
Revision as of 22:40, 3 February 2018