开发者

kohana how to bundle javascript into view

开发者 https://www.devze.com 2023-02-09 01:06 出处:网络
I have a javascript with a counter, and a view. I want the javascript counter to start whenever some one hits the buy product button.

I have a javascript with a counter, and a view. I want the javascript counter to start whenever some one hits the buy product button.

my problem is: how开发者_StackOverflow社区 can i control the javascript from the kohana controller, and how can i bundle the javascript into a view?

thanks!


You can bundle the JS into the view just like into a typical .php page.

If page causes a post-back just start the JS timer on page load as usual.

If page uses AJAX, place JS into the content view. Then have a controller send a message that triggers the JS timer to count down.

Otherwise I'm not exactly sure what you're asking.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号