EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on March 19, 2018, 02:57:09 AM



Title: switch all requests to POST
Post by: devnull on March 19, 2018, 02:57:09 AM
Hi;

What is the easiest / best method to switch every control to use POST instead of GET ??

Thanks



Title: Re: switch all requests to POST
Post by: jarry on March 19, 2018, 03:25:10 PM
The post is the default method for all the form components to post to remote server.


Title: Re: switch all requests to POST
Post by: devnull on March 20, 2018, 07:06:28 AM
Sorry, what I meant was how can I easily switch all objects between POST and GET method.

Thanks



Title: Re: switch all requests to POST
Post by: jarry on March 21, 2018, 02:52:57 AM
This function changes the request method of all form components on the page.
Code:
function setRequestMethod(method){
    var plugins = $.parser.plugins;
    for(var i=0; i<plugins.length; i++){
        var name = plugins[i];
        $('.'+name+'-f').each(function(){
            var state = $(this).data(name);
            if (state && state.options && state.options.method){
                state.options.method = method;
            }
        });
    }
}