$(function(){
$('#textb').keypress(function (e) {
var key = e.which;
var messag=document.getElementById('textb').value;
if(key == 13)
{
window.location.href = "refresh/?mesag=" + messag;
}
});
});
how to pass variable to controller from view in codeigniter
View:
if(key == 13){
$.post( "route/to/post/to", { id: "2"} );
}
Controller:
if($this->input->post("id")){
echo $this->input->post("id");
}
This will echo 2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.