2

There is a jQuery plugin called pjax (https://github.com/defunkt/jquery-pjax/) for downloading page content via ajax.

How can you integrate pjax in Craft for downloading entries via ajax? Or are there other ways to download entries via ajax?

1 Answer 1

2

In order to make an AJAX call in Craft, you'll need to build a custom plugin. Within the context of your plugin, add a Controller as the end-point for your AJAX call. Once you've setup your controller, take a look at the EntriesService API methods to sort out exactly how to retrieve your entry data.

If you've never built a plugin or are unsure of where to begin, you can download this Business Logic template to use as a starting point. It comes pre-packaged with a controller containing a simple AJAX call (and a lot of "how-to" notes).

If you have any follow-up questions along the lines of "how do I collect the data for my AJAX call", those would be worthy of being their own Stack Exchange questions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.