EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on October 12, 2012, 04:10:30 AM



Title: Setting form request header
Post by: devnull on October 12, 2012, 04:10:30 AM
can you tell me how to apply the header:

setRequestHeader("X-Requested-With", "XMLHttpRequest")

to the easyui form object as does not appear to be set ?

Thanks


Title: Re: Setting form request header
Post by: stworthy on October 13, 2012, 04:52:10 AM
Setting header is not supported in form plugin.


Title: Re: Setting form request header
Post by: arma on April 16, 2018, 03:32:33 PM
Any workaround for this so we can identify in backend if post request is an ajax request?


Title: Re: Setting form request header
Post by: stworthy on April 16, 2018, 06:48:33 PM
Try to call ajaxSetup to set the header globally. Make sure to set the 'iframe' to false when submitting a form.
Code:
$.ajaxSetup( {
    headers: {
        //...
    }
});