• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

call a function from a link

i already have a xen:callback that runs the function on page load. i want to add a link where the user clicks it to re run the function as many times as he likes

function loadMore()
echo "look a new line! <br/>";

then in my template
<a href="???">Magic!</a>

it will call the function

can this be done?
didn't work :(
i tried this also didn't work :(
<a href="#" onclick="{xen:callback class='my_php_file' method='loadMore'}">Magic!</a>

Daniel Hood

Well-known member
Oh, yeah. That's not how that works at all. The callback tag is to render content from php. You need to trigger Javascript that makes an Ajax request to the php.