Hello I want to serialize and unserialize a form with jquery But I don't know how to get all attributes of all elements in a serialized way? please anyone help thankyou......
+1
A:
jQuery has a serialize function.
$("#form").serialize(); // Returns serialized string
Reference: http://api.jquery.com/serialize/
Pekka
2010-06-23 09:07:16
A:
All elements in the form will be sent along if using the $('form').serialize();
nillls
2010-06-23 09:08:23
+1
A:
.serialize() will map your input controls that have a name attribute defined into a standard query string:
foo=bar&bar=foo&and=soon
That kind of string is easy accesible in almost every "backend" programming language.
If you need to serialize object information, use JSON.
var obj = {
foo: 'bar',
more: 'etc
};
serialize this with window.JSON.stringify(obj);. To unserialize such a JSON string, use window.JSON.parse(str);, which returns a javascript object.
Many languages support this principle.
jAndy
2010-06-23 09:17:51
hi there, why do jquery use name attribute to serialize a form (instead of using id attribute?)
frabiacca
2010-06-30 16:06:22