php - how to assign textbox value directly to session in codeigniter with out form -
<input type="hidden" id="lang" class="form-control" value="english"> <?php $this->session->set_userdata('user_lang', 'arabic');?>
on dropdown change textbox value changed need assign textbox value session without form in codeigniter
you can use jquery trigger change of value. , run ajax set session data
$('#lang').change(function(){ var val = $(this).val(); $.ajax({ url: "<?=site_url('your_controller/your_method')?>", type: "post", data: {val: val}, success: function(res){ // code after ajax completed } }); });
now @ controller create new method set session data
functoin your_method(){ $this->session->set_userdata('user_lang', $this->input->post('val')); }
Comments
Post a Comment