<p>There is an overview of how routing works in Craft here: <a href="https://craftcms.com/docs/routing" rel="nofollow">https://craftcms.com/docs/routing</a> and that guide works for front-end routing as well as Craft's own control panel routing when deciding which (if any) templates to render.</p>

<p>The call to <code>p=admin/actions/elementIndex/getElements</code> is a control panel AJAX action request (#3 is the routing list) that's going to the <code>craft/app/controllers/ElementIndexController.php</code>'s <code>actionGetElements</code> method and returning data.</p>

CC BY-SA 3.0
2016-07-06T03:35:09.543Z
Hey Brad, thanks for your help! I figured this part out, but where I am still confused is is the _getElementHtml function which renders the Html that is sent as the response. From where does it get the HTML, how does it know  which template to use as it is very generic and used by many cp views? Thanks!
user2997606
CC BY-SA 3.0
2016-07-05T21:06:40.087Z
2016-07-05T21:06:40.087Z
Brad Bell
<p>I am new to Craft and I am trying to figure out how routing works. When I click on an entries nav item, it makes a request to:</p>

<pre><code>.com/index.php?p=admin/actions/elementIndex/getElements
</code></pre>

<p>The url of the item is <code>.com/entries/affiliates</code> and the call is ajax. </p>

<p>There is a section called affiliates, but the 'template' field is Null. I can't seem to figure out where the response is coming from.</p>

<plugin-development>
How URL Mapping Works
# How URL Mapping Works

(Asked by: username_0 on 2016-07-05)

I am new to Craft and I am trying to figure out how routing works. When I click on an entries nav item, it makes a request to:
.com/index.php?p=admin/actions/elementIndex/getElements

The url of the item is .com/entries/affiliates and the call is ajax. 
There is a section called affiliates, but the 'template' field is Null. I can't seem to figure out where the response is coming from.

**Tags:** plugin-development


---

## 1 answers

### Answer by username_1 on 2016-07-05. Score: 2

There is an overview of how routing works in Craft here: <https://craftcms.com/docs/routing> and that guide works for front-end routing as well as Craft's own control panel routing when deciding which (if any) templates to render.

The call to `p=admin/actions/elementIndex/getElements` is a control panel AJAX action request (#3 is the routing list) that's going to the `craft/app/controllers/ElementIndexController.php`'s `actionGetElements` method and returning data.

> **Comments:**
> **username_0**: Hey Brad, thanks for your help! I figured this part out, but where I am still confused is is the _getElementHtml function which renders the Html that is sent as the response. From where does it get the HTML, how does it know  which template to use as it is very generic and used by many cp views? Thanks!  

---

