# Page model on an ajax page?

**URL:** <https://forum.getkirby.com/t/page-model-on-an-ajax-page/1776>\
**Category:** Questions\
**Tags:** v2\
**Created:** [August 6, 2015, 11:40am UTC](https://forum.getkirby.com/t/page-model-on-an-ajax-page/1776 "2015-08-06T11:40:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [August 6, 2015, 11:40am UTC](https://forum.getkirby.com/t/page-model-on-an-ajax-page/1776/1 "2015-08-06T11:40:09Z")

</div>

I have an ajax page which I created with a route. Therefor it’s not a “normal” page. It’s like a virtual page.

I use this to get my `$pages` object:

```
$pages = kirby()->site()->pages();

```

Then I use a snippet where I put the page object:

```php
$out .= snippet(
    'items',
        array(
            'pages' => $pages,
    ),
    true
);

```

## Question

Can I use a page model in this case? How? It’s not a real page.

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [August 6, 2015, 11:52am UTC](https://forum.getkirby.com/t/page-model-on-an-ajax-page/1776/2 "2015-08-06T11:52:25Z")

</div>

In theory, yes (`$pages` contains the real pages).  
But unfortunately, once again, models are loaded after plugins. Plugins are currently simply not made for complex stuff like this. 😄

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [August 6, 2015, 12:05pm UTC](https://forum.getkirby.com/t/page-model-on-an-ajax-page/1776/3 "2015-08-06T12:05:10Z")

</div>

I always seems to end up with the same kind of issue, the order of things. Thanks!

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [August 6, 2015, 12:16pm UTC](https://forum.getkirby.com/t/page-model-on-an-ajax-page/1776/4 "2015-08-06T12:16:10Z")

</div>

Haha, it seems so. 😃

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:16pm UTC](https://forum.getkirby.com/t/page-model-on-an-ajax-page/1776/5 "2025-02-06T17:16:56Z")

</div>


