You can give the Ajax component an explicit name and later use jQuery.web2py.component to call it by name and refresh it:
{{=LOAD(c='default', f='ajaxTask', args=[-1], ajax=True, target='task_form' )}} That will result in the id of the component div being set to "task_form", so you can easily identify it in other code. When you want to refresh the component with a new value of tidi: var taskUrl = '{{=URL('default', 'ajaxTask')}}'; jQuery.web2py.component(taskUrl + '/' + tidi, 'task_form') Anthony On Monday, November 16, 2015 at 8:11:34 AM UTC-5, lucas wrote: > > hey anthony, > > ok, i read the docs you linked me to. still not seeing the details well > enough to get me through. sorry, i am thick sometimes. i put in the view: > > {{block head}} > <script type="text/javascript"> > function clk_form(tidi) { > if (tidi != 0) { > jQuery('div#form').css('display','inline'); > } else { > jQuery('div#form').css('display','none'); > } > return false; > } > </script> > {{end}} > > <a onclick="clk_form(-1)" title="Create/Assign New Task" class="btn mtt" > style="font-size:14pt;"><b>New Task</b></a> > <a onclick="clk_form(0)" title="Hide Task Entry Form" class="btn mtt" ">No > Form</a> > > <br /><div id="form" style="float: none; display: none;"> > {{=LOAD(c='default', f='ajaxTask', args=[-1], ajax=True)}} > </div> > > and the function under the controller is pretty basic: > > def ajaxTask(): > try: > tidi = int(request.args[0]) > except: > tidi = 0 > frm = None > if tidi and (tidi <> 0): > if (tidi == -1): > tidi = None > frm = SQLFORM(tTask, record=tidi, showid=False) > return frm > > so the form loads into the DIV fine. and when i add a new record, it does > actually work. however, i can not see how to change the args value of the > LOAD function from other areas of the page. you see now i have it > hardcoded at -1. so how can i affect that args value from somewhere else > in the page and then have it RELOAD the contents of the DIV? > > thanx in advance, lucas > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.