Opposite serializeArray in jQuery (recovery form)

Having data from serializeArray , how can you update the form?

 var values = form.serializeArray(); form.deserializeArray(value); // What is the deserializeArray analogue? form.seriaizeArray() === values; // So that this is always true 
+7
source share
3 answers

We can iterate over the array and restore the form.

 for (var i = 0; i < values.length; i++) { $("input[name='" + values[i].name + "'], select[name='" + values[i].name + "']").val(values[i].value); } 
+3
source

The opposite of serializeArray is .param ()

In fact, the serialize function first executes serializeArray and then applies the param () parameter

 serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { ... 
0
source

All Articles