VAAA VAAA - 6 months ago 28
jQuery Question

Jquery how to append and serialize an array

I have a form that it's being serialized:

// save data
var data = $('#siteForm input').serialize();

Data will contain the following:


Now I have an array of strings:

var contents = $('#screenlist').html().split(/\n|\<br>/).filter(function(v) {
return /\w+/.test(v);
var links = {};

for (var k in contents) {
links[k] = contents[k];

And now I need to append
array into my data serialized content so my server can catch it.

Any clue?


I think you're looking for $.param().


Create a serialized representation of an array, a plain object, or a jQuery object suitable for use in a URL query string or Ajax request...

var obj   = {foo:'b a r',blah:'ha=lb'},
    query = $.param(obj);

<script src=""></script>
<div id="output"></div>