Finally I managed to do it.
Thanks for the good advices!
El 09/05/2014 a les 06:43 PM, Krinkle ha escrit:
It couldn't be more simple I'm afraid. Replace "get" with "post".
Note that both of these are just shortcuts to the more advanced "$.ajax" method, so if the reduced set of options exposed in get() and post() isn't enough, just call ajax() directly.
https://api.jquery.com/jQuery.get/ https://api.jquery.com/jQuery.post/ https://api.jquery.com/jQuery.ajax/
— Krinkle
PS: Please use the Promise interface, not the callback parameters. Don't forget to handle errors, either.
PS2: While this will help you get the request over POST, the underlying subsystem you're communicating with (action=ajax) has been deprecated for many years now. Please rewrite these global functions in a more modular fashion by creating an API module.
https://www.mediawiki.org/wiki/API:Main_page
On 3 Sep 2014, at 17:42, Toni Hermoso Pulido <toniher@cau.cat mailto:toniher@cau.cat> wrote:
Hello,
for different custom extensions I've been doing something like this with GET:
$.get( mw.util.wikiScript(), { format: 'json', action: 'ajax', rs: 'MyExt::MyFunction', rsargs: [param1, param2] }, function(data) { // console.log(data); });
MyExt::MyFunction is in $wgAjaxExportList[].
However, since now I have too much data for a URL (414 HTTP error) I'd prefer to use POST. So far I have not found a proper way to build it. Any idea or advice?