<p>In order to make an AJAX call in Craft, you'll need to <a href="http://buildwithcraft.com/docs/plugins/introduction" rel="nofollow">build a custom plugin</a>. Within the context of your plugin, add a <strong><a href="http://buildwithcraft.com/docs/plugins/controllers" rel="nofollow">Controller</a></strong> as the end-point for your AJAX call. Once you've setup your controller, take a look at the <a href="http://buildwithcraft.com/docs/apis/entriesservice" rel="nofollow">EntriesService API methods</a> to sort out exactly how to retrieve your entry data.</p>

<p>If you've never built a plugin or are unsure of where to begin, you can download this <a href="https://github.com/lindseydiloreto/craft-businesslogic" rel="nofollow">Business Logic template</a> 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).</p>

<p>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.</p>

CC BY-SA 3.0
2014-08-07T02:53:35.243Z
2014-08-07T02:53:35.243Z
Lindsey D
<p>There is a jQuery plugin called pjax (<a href="https://github.com/defunkt/jquery-pjax/" rel="nofollow">https://github.com/defunkt/jquery-pjax/</a>) for downloading page content via ajax.</p>

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

<ajax>
How can you use the jQuery pjax plugin with Craft?
# How can you use the jQuery pjax plugin with Craft?

(Asked by: username_0 on 2014-08-06)

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?

**Tags:** ajax


---

## 1 answers

### Answer by username_1 on 2014-08-07. Score: 2

In order to make an AJAX call in Craft, you'll need to [build a custom plugin](http://buildwithcraft.com/docs/plugins/introduction). Within the context of your plugin, add a **[Controller](http://buildwithcraft.com/docs/plugins/controllers)** as the end-point for your AJAX call. Once you've setup your controller, take a look at the [EntriesService API methods](http://buildwithcraft.com/docs/apis/entriesservice) 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](https://github.com/lindseydiloreto/craft-businesslogic) 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.


---

