I have several switches and if i change a switch i need to store switch value to database.each and every switch have different id's and using that checkbox id how to change the switch manually in javascript. like this < input id="2" type="checkbox" checked onchange="call_switch(2,this);" >
function call_switch(id , switch_status)
{
$.ajax(
{
url: '/change_switch',
type: "post",
data: 'row_id='+id+'&switch_status='+switch_status,
success: function(resp1)
{
//switch state on for particular switch
},
error: function(e1)
{
//switch state off for particular switch
}
});
}