Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Example using ajax

Started by Muut Archive 10 years ago · 1 replies · 696 views
10 years ago

Could you please give me an example how to use ajax in grav ?

I'm able to send a GET request with jquery to a page, but i don't know where to put the logic for its processing, and i need write the code in php or twig ?

Thanks !

10 years ago

I assume you'd like the URL you call to "do something" or to return some json values. You need to write a plugin that listens on a URL and returns some results.

https://github.com/flaviocopes/grav-plugin-api is a example (draft) of a plugin that provides an API. You can see how that is built, and create your own plugin.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2956 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago