JQuery serializable and non-serializable

I want to serialize and not serialize a form using jQuery.

How can I get all the attributes of all elements in a serialized way?

+5
source share
3 answers

jQuery has a function serialize.

$("#form").serialize(); // Returns serialized string

Link: http://api.jquery.com/serialize/

+1
source

. serialize () will display input controls that have the name attribute defined in the standard query string:

foo=bar&bar=foo&and=soon

Such a line is easily accessible in almost every backend programming language.

If you need to serialize object information, use JSON.

var obj = {
    foo:  'bar',
    more: 'etc
};

window.JSON.stringify(obj);. ​​ JSON, window.JSON.parse(str);, javascript.

.

+15

All elements in the form will be sent using $ ('form'). serialize ();

+1
source

All Articles