views:

11

answers:

1

Hello all i'm turning objects "on (adding the class .active) and off" on a html page with html objects, not forms. And on every click i want it to create an array of the items with the class .active but i can't seem to get any results?!

is this in the right direction?

var data = $('li.tagToggle.active').serializeArray();
// li id format is 'id_0001' 
alert(data)
$.post("/scripts/php/process.php",{ 
         'data[]': data,
         funcName : 'tagResults',
         tagResults : '1'
}) 

keeps alerting and empty window but when i use this on a form it grabs all the objects with the class .active

any pointers welcome!

A: 

ok - got this to work but its nots as neat as serialize()

function getTags(){

    var data = [];

    $('li.tagToggle.active').each(function(){
        var me = $(this);
        var id = me.attr("id").split('_');
        data.push(id[1])

    });

    $.post("/scripts/php/process.php",{ 
         'data': data,
         funcName : 'tagResults',
         tagResults : '1'
    }) 

}

think there's a better method?

daniel Crabbe