This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

n30h.slyfo4920
n30h.slyfo4920

I d like to make a button which calls a function in my plugin component.

This is what im using now
{{ form_open({ request: 'upVote' }) }}

    <button class="btn" type="submit" >+</button>

{{ form_close() }}

Id like to call upVote function without the form and without refreshing the page

Scott
Scott

Try renaming your ajax method to use the "onName" convention (http://octobercms.com/docs/cms/ajax#ajax-handlers), then give this code a try

<a href="#" data-request="onUpVote">+</a>
Daniel81
n30h.slyfo4920
n30h.slyfo4920

Scott: Ahh thanks it works

Shapeless
Shapeless

Was wondering if there was a way to do this but also passing post data to the function?

Scott
Scott

Yes, take a look at the data-request-data spec

http://octobercms.com/docs/cms/ajax#data-attributes

1-6 of 6

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.