user3728425
user3728425

Reputation: 183

How to call a javascript function in cakephp2?

Im new to both cakephp2 and jquery, and I need some help.

I have two .ctp files, one is to display a list of datas from the database (vertical_list.ctp) and another .ctp contains the button to display 10 more data in the list.

<div class="loading" style="text-align:center"><a href="javascript:void(0);" id="loadmore">Display 10 more</a></div>

It is a Element (more_data.ctp) .

I have $this->element('Mobile/more_data); element in the vertical_list.ctp and I want to call the javascript function but I'm not sure how to do this.

Upvotes: 1

Views: 60

Answers (1)

Jennifer
Jennifer

Reputation: 1852

Use something like the sample below . I'm new to cakephp2 myself but I was able to access the js scripts function.

 sample $this->Js->Action();

Upvotes: 1

Related Questions