Skip to content

call Manual inline javascript function with my own parameter when switch changes. #462

@periyasamy25

Description

@periyasamy25

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
}
});
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions