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 !
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 !
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.
Log in to reply.
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 1359 | 9 years ago | ||
| 2 | 936 | 9 years ago | ||
| 2 | 4066 | 9 years ago | ||
| 1 | 2956 | 9 years ago | ||
| 3 | 1121 | 9 years ago |