jQuery: The Write Less, Do More JavaScript Library

Re: jQuery ajaxSubmit(), how to send the form in a json format?

by James-279 :: Rate this Message:

Reply to Author | View in Thread


I'm curious what's the reason for that also.

However, if you really need to put into JSON to send over to the
server, you can first use serializeArray()
http://docs.jquery.com/Ajax/serializeArray
to convert all the form data into JSON (object format), and then use
this official JSON script:
http://www.json.org/json2.js
Use the stringify function to convert the JSON into a literal String,
which you can send over to the server.

On Jul 2, 5:22 am, Giovanni Battista Lenoci <gian...@...> wrote:

> DaNieL ha scritto:> i'll love that the plugin will send a request like:
>
> > mypage.php?mytest=[{'firstone':'here some text!','secondone':'text in
> > here too'}]
>
> > Is it possible?
>
> Don't know, but I'm curious, what's the motive behind this choice? If
> you pass a json object you have to convert in an array with json_decode
> to have an array similar to $_POST, right?
>
> --
> gianiaz.net - web solutions
> via piedo, 58 - 23020 tresivio (so) - italy
> +39 347 7196482

 « Return to Thread: jQuery ajaxSubmit(), how to send the form in a json format?