EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: mapner on July 01, 2017, 06:59:40 AM



Title: Sending form data in Json format
Post by: mapner on July 01, 2017, 06:59:40 AM
Hi,

I want to send data from a form in Json format to server.
I use this:
Code:
$('#f-esp').form('submit', {
url : ....
contentType: 'application/json',
                dataType: 'json',
onSubmit : function(param) {
....

But, the HTTP Header send it
Content-Type:application/x-www-form-urlencoded

thanks


Title: Re: Sending form data in Json format
Post by: jarry on July 02, 2017, 02:43:55 AM
You can call 'serialize' or 'serializeArray' methods to encode it as a JSON string and then post to server.


Title: Re: Sending form data in Json format
Post by: mapner on July 03, 2017, 08:42:24 AM
Thanks!