Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Executing controller function via AJAX


Go to End


2 Posts   1169 Views

Avatar
MarioSommereder

Community Member, 107 Posts

27 August 2012 at 9:10pm

Hi.

Is it possible to execute a controller function through Ajax? I want to get an array with objects the function fetches for me, but I have no clue how to execute the function.

Thanks in advance.

- Mario -

Avatar
zenmonkey

Community Member, 545 Posts

28 August 2012 at 12:46am

You can execute a controller function using the the $Page/$Action/$Parameter url pattern, where $Page is the URL, the $Action is the name of the controller function and $Parameter is an variable you may need to push.

It should be noted that if you're trying to get data to display on the site your better off using RenderWith on the action that calls a template that renders the data and use it as a jQuery object