I’m having a little trouble getting Jquery to play nice with cakephp and I’m not really sure what the problem is.
view file, View/Members/index.ctp
<script>
$(document).ready(function(){
$("#place").click(function(event){
$("#place").load('/member/jax', function(){
alert("load successful");
});
});
});
</script>
<div id="place"></div>
Controller file Controller/MembersController
public function jax() {
echo "<p>TESTTHIS</p>";
$this->layout='ajax';
$this->render('/Elements/test');
}
and for completeness
Test element /View/Elements/test.ctp
<b>test element</b>
When I click on the div I get the “load successful” popup, but I do not get the “
TESTTHIS
that I expect the controller to print out, nor do I get the “test element” from the render.
Can anyone tell me where I’m going wrong?
Thanks.
you can try with following:
Conventionally controller in CakePHP call with plural name. So, I think it should
membersnotmember.