I need to set session in Jquery but when i try it does not work this is i am doing in jquery
var a = 22;
<?php $this->session->set_userdata('friend_id' ,a )?>
it gives me syntax error, anyone knows how to solve it.
I need to set session in Jquery but when i try it does not work this is i am doing in jquery
var a = 22;
<?php $this->session->set_userdata('friend_id' ,a )?>
it gives me syntax error, anyone knows how to solve it.
You can use hidden field to do this
<input type="hidden" value="" name="id" id="id" />
this will in your js
var a = 22;
document.getElementById('id').value = a;
hope this will help you to solve your problem, but you can't set session in Jquery