I have the following issue: in cakaphp does not advice anymore the using of jshelper,insted of normal javascript.
<?php
$this->Js->get('#PostCategoryId')->event('change',
$this->Js->request(array(
'controller'=>'subcategories',
'action'=>'getByCategory'
), array(
'update'=>'#PostSubcategoryId',
'async' => true,
'method' => 'post',
'dataExpression'=>true,
'data'=> $this->Js->serializeForm(array(
'isForm' => true,
'inline' => true
))
))
);
?>
I don't know how to execute cake controller in js(without using jshelper):
$this->Js->request(array(
'controller'=>'subcategories',
Normally in core php, i would do like this:
$("select#category").change(function(){
var id = $("select#category option:selected").attr('value');
$.post("select_type.php", {id:id}, function(data){//select_type.php is the "controller"
$("select#type").html(data);
});
});
But how to use controller in javascript(jquery)?I am not sure but will it works if i do like this:
$.post("posts/subcategories/getByCategory", {id:id}, function(data){