i m suffering with Passing values from javascript function to controller in cakephp and get using $_POST.
i have tried it by different ways but didn’t get success please suggest.
my code is controller
function index(){
$wow='rajesh';
$this->set('data',$wow);
$raj=$_POST['value'];
echo $raj;
}
javascript function
checkLength(obj){
alert(obj);
//var raj=document.getElementById("searchText").value;
//alert(raj);
remoteCall("/cakephp/notes/index","&raj="+obj,"");
//window.location.href = "http://localhost/cakephp/notes/index/value=" + obj ;
}
my guess would be that you want to change this line
to
as you seem to want the value of the raj parameter