JQuery make an array - how/what is best
Posted
by russp
on Stack Overflow
See other posts from Stack Overflow
or by russp
Published on 2010-05-28T05:47:05Z
Indexed on
2010/05/28
5:51 UTC
Read the original article
Hit count: 266
I have 4 serailized arrays that I want to pass to php for processing. What is the best way to combine them into a single array>
example:
serial_1 = $('#col1').sortable('serialize');
serial_2 = $('#col2').sortable('serialize');
serial_3 = $('#col3').sortable('serialize');
serial_4 = $('#col4').sortable('serialize');`
each serialized array relates to a column/section of the page (col1,col2 etc.) What I need to do/would like to do is create a single array that puts the serialized array inside another array for a single post.
example:
var new_array = serilaize(col_1(serial_1),col2(serial_2),col3,(serial_3),col4(serial_4))
I KNOW THAT IS NOT RIGHT as I have no idea in JQuery how to right the correct syntax.
This new array is to be posted via ajax like this:
$.ajax({
url: "test.php",
type: "post",
data: new_array,
error: function(){
alert('SOME ERROR MESSAGE');
}
});
Thanks in advance
© Stack Overflow or respective owner