/views/default/index.html
<!-- begin -->
<button class="load_content" data-url="{{=URL('default', 'otherthing1')}}"
data-target="ajax_container"> Click to load content1 </button>
<button class="load_content" data-url="{{=URL('default', 'otherthing2')}}"
data-target="ajax_container"> Click to load content2 </button>
<button class="load_content" data-url="{{=URL('default', 'otherthing3')}}"
data-target="ajax_container"> Click to load content3 </button>
<button class="load_content" data-url="{{=URL('default', 'otherthing4')}}"
data-target="ajax_container"> Click to load content4 </button>
<div id="ajax_container"> <!-- CONTENT COMES HERE --> </div>
<script>
$(function () {
$('.load_content').on('click', function (e) {
elem = $(this);
url = elem.attr("data-url");
target = elem.attr("data-target");
web2py_ajax_page("GET", url, "", target)
return false; // e.preventDefault()
});
})
</script>
<!-- end -->
*Bruno Cezar Rocha** - @rochacbruno*
[email protected] | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: Sending emails with Python and
Gmail<https://rochacbruno.snipt.net/sending-emails-with-python-and-gmail/>
Get a signature like this.
<http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18>
Click
here.<http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18>
On Fri, Aug 10, 2012 at 6:08 AM, Rob Goldsmith <[email protected]>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.
>
> --
>
>
>
>
--