Note,
{{=LOAD('default','myaction', ajax=True)}}
is just a helper that produces the following HTML:
<script type="text/javascript"><!--
web2py_component('/test/default/myaction','c784764977599');
//--></script><div id="c784764977599">loading...</div>
So, you can trigger a component loading in a div by manually calling the
web2py_component() function in the browser and specifying a target div.
Note, if you want the component to load initially via LOAD() and then make
subsequent calls to web2py_component() to load other content into the div,
you can specify your own id for the div instead of having LOAD() generate a
random id as above:
{{=LOAD('default','myaction', ajax=True, target='mydiv')}}
yields:
<script type="text/javascript"><!--
web2py_component('/test/default/myaction','mydiv');
//--></script><div id="mydiv">loading...</div>
Bruno mentioned the use of web2py_ajax_page() -- that function is
ultimately called by web2py_component(), so either will work, but
web2py_component() is probably easier.
Anthony
On Friday, August 10, 2012 5:08:49 AM UTC-4, Rob Goldsmith wrote:
>
> Hi
> Is it possible to trigger the LOAD component when a user clicks on
> something, or can it only be used when a page is first loaded?
> I have been using the ajax function to do this but would prefer the extra
> flexibility of LOAD if it is possible.
>
> thanks
> Rob.
>
>
--