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

Global Ajax Call


Go to End


3 Posts   617 Views

Avatar
RafaelNZ

Community Member, 1 Post

1 June 2016 at 11:29am

I need to be able to make an generic ajax call from any page and get the same result with my custom template.
I already have that for specific pages, but now I need to be able to make an specific request from any page. I thought of having it on the Page.php but that access is forbidden, so I'm just wondering if someone can help me out with this one.

Not sure if i was clear enough, so let me know and I may try to explain this a bit better.

Avatar
martimiz

Forum Moderator, 1391 Posts

4 June 2016 at 12:59am

Edited: 04/06/2016 12:59am

Assuming you want to Ajax-call an action in your Page_Controller - did you add the function name to the $allowed_actions array in said Page_Controller and then do ?flush=all?

Avatar
RafaelNZ2

Community Member, 1 Post

7 June 2016 at 9:18am

Hmm. I've tried it.
But the thing is that I want to be able to make the calls from anywhere.
Parent -> Parent (Master Controller)
Child -> Parent (Master Controller)
Child/Child -> Parent (Master Controller)

But hitting the same controller, so that I can have this generic code only in one place, keeping me from adding the same code over and over again to all controllers of the website.

If I can make that using Page.php, what would be the url address to always get to it? I've tried some variations so far, but i either get not found or forbidden.