thank you so much for your correction, massimo. it runs right now with: jQuery(document).ready(function(){ jQuery('.view').click(function(){jQuery('.comments').slideToggle()}); jQuery('.post').click(function(){jQuery('.form').slideToggle()}); jQuery('.post').submit(function(){ajax('{{=request.controller}}', [], 'comments hidden')}); });
it seems for the first, second and third data inserted the ajax function is not running properly, i mean, i must refresh the browser, but after the third data, ajax function is running smoothly, where is my wrong code that i must fix it? currently i separate the javascript into the static js folder like code above, and call it on the views. thank you very much before On Thu, Apr 28, 2011 at 9:12 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > yes but the syntax is incorrect: > > ajax('blog_show', 'comments hidden') > > should be > > ajax('blog_show', [....], 'target_id') > > > > On Apr 28, 8:58 am, 黄祥 <steve.van.chris...@gmail.com> wrote: > > hi, > > > > is it possible to put ajax function submit on script? > > e.g. > > <script> > > jQuery(document).ready(function(){ > > jQuery('.view').click(function() > > {jQuery('.comments').slideToggle()}); > > jQuery('.post').click(function(){jQuery('.form').slideToggle()}); > > jQuery('.post').submit(function(){ajax('blog_show', 'comments > > hidden')});}); > > > > </script> > > > > i've already tried it, no error occured but the ajax function didn't > > work. my intention is when a user submit a comment form (using crud on > > controller) it will show without reloading the page, or is there any > > others way to do this? > > > > please give an advice and please correct me if my code is wrong. > > > > many thanks before