jquery - array problem help pls.
- by russp
Sorry folks, I really need help with posting an array problem. I would imaging it's quite simple, but beyond me.
I have this JQuery function (using sortables)
$(function() {
$("#col1, #col2, #col3, #col4").sortable({
connectWith: '.column',
items: '.portlet:not(.ui-state-disabled)',
stop : function () {
serial_1 = $('#col1').sortable('serialize');
serial_2 = $('#col2').sortable('serialize');
serial_3 = $('#col3').sortable('serialize');
serial_4 = $('#col4').sortable('serialize');
}
});
});
Now I can post it to a database like this, and I can loop this ajax through all 4 "serials"
$.ajax({
url: "test.php",
type: "post",
data: serial_1,
error: function(){
alert(testit);
}
});
But that is not what I want to do as it creates 4 rows in the DB table.
I want/need to create a single "nested array" from the 4 serials so that it enters the DB as 1 (one) row.
My "base" database data looks like this:
a:4:{s:4:"col1";a:3:{i:1;s:6:"forums";i:2;s:4:"chat";i:3;s:5:"blogs";}s:4:"col2";a:2:{i:1;s:5:"pages";i:2;s:7:"members";}s:4:"col3";a:2:{i:1;s:9:"galleries";i:2;s:4:"shop";}s:4:"col4";a:1:{i:1;s:4:"news";}}
Therefore the JQuery array should "replicate" and create it (obviously will change on sorting)
Help please thanks in advance