guys how to make a checkbox, if i check it the value on checkbox will send to database without submit form function
this is my checkbox :
<input id="active_banner" type='checkbox' name='active_banner' value='1' title='Active Banner' <?=($data->promotion_active == 1)? "checked":""?> />
and this is my jquery :
<script>
$("#active_banner").click(function() {
var id = "<?=$data->promotion_banner_id?>"
var active = $("#active_banner").val();
jQuery.ajax({
type: "GET",
url: "/ADMIN/ajax/active_banner/",
data: {id:id,active:active},
});
});
</script>
i have tried to checked but, there is nothing happen in my ajax controller there is contain :
function active_banner(){
$id = $this->input->get("id",true);
$active = $this->input->get("active",true);
$this->Control_panel_m->update_banner_active($id,$active);
redirect('/ADMIN/'.country_code."/Edit_promotion_banner","refresh");
}
guys can you help me how to make it work?
Aucun commentaire:
Enregistrer un commentaire