jQuery: What to do with the list that sortable('serialize') returns?

Posted by bartclaeys on Stack Overflow See other posts from Stack Overflow or by bartclaeys
Published on 2009-03-17T14:43:36Z Indexed on 2010/05/19 20:50 UTC
Read the original article Hit count: 195

Filed under:
|
|
|

With jQuery I'm retrieving positions of a sortable list using 'serialize', like this:

var order = $('ul').sortable('serialize');

The variable 'order' then receives the following:

id[]=2&id[]=3&id[]=1&id[]=4&id[]=5

Now how can I use this data in an ajax call?

This is how I plan to do it, but it's ugly and I can't change the parameter name 'id':

$.post('ajax.php?'+order,{action:'updateOrder'});

Maybe I need to unserialize, then implode the variable 'order' and assign it to just one parameter?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about sortable