Is it possible to get the serialized list of items from a UL in jquery by calling the serialize method directly instead of using a callback? The code snippet:
va
var formStr = $('#container').serialize()
Added: That will work for form elements. You could also roll your own serialize like so:
function serializeList(container)
{
var str = ''
var n = 0
var els = container.find('li')
for (var i = 0; i < els.length; ++i) {
var el = els[i]
var p = el.id.lastIndexOf('_')
if (p != -1) {
if (str != '') str = str + '&'
str = str + el.id.substring(0, p) + '[]=' + (n + 1)
++n
}
}
return str
}
alert(serializeList($('#container')))