Hey guys,
check out this code below:
$('#reorder').click(function( event){
var order = $('#gallery').sortable('serialize',{key:'string'});
console.log(order);
});
This gives me a string :
string=1&string=2&string=3&string=4
I only want the numbers and I want them as an array to send via AJAX to my server side script to re-order the database. Please advise.
thanks
Silversurfer
The serialize method in the sortable documentation says that it automatically uses array notation when you don’t provide a key.
[indent]It works by default by looking at the id of each item
in the format ‘setname_number’, and it spits out a hash like
“setname=number&setname=number”.
[/indent]
[SOLVED]
Ah excellent, thanks Paul,
I also didn’t realize that:
index=2&index=1&index=3&index=4
is the same as: index[0]=2, index[1]=1, index[2]=3, index[3]=4
I am used to sending scalar GET and POST variables but this is the first time I have had to send a vector.