After clicking on the Add button, I want to gather all the id s from tickboxes and the values from dropdown... and put them into json data.. what is the correct way to do this?
Here what I have managed below but data
did not include index/key name of dropd and ticks.
$(".add").live( click , function() {
var ticks = {};
var dropd = {};
var data = {}
$( INPUT:checked ).each(function (i) {
tickID = $(this).attr("id");
ticks[i] = {
id: tickID
};
});
$( OPTION:selected ).each(function (i) {
selectID = $(this).val();
dropd[i] = {
id: selectID
};
});
$.extend(data, ticks);
$.extend(data, dropd);
console.log(data);
//ajax code block here to send json data
});