# Compatibility with Pjax

**URL:** <https://community.miniprofiler.com/t/compatibility-with-pjax/80>\
**Category:** uncategorized\
**Created:** [August 5, 2012, 1:12pm UTC](https://community.miniprofiler.com/t/compatibility-with-pjax/80 "2012-08-05T13:12:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![siot](https://sea2.discourse-cdn.com/flex016/user_avatar/community.miniprofiler.com/siot/32/455_2.png) [@siot](https://community.miniprofiler.com/u/siot)\
**Post date:** [August 5, 2012, 1:12pm UTC](https://community.miniprofiler.com/t/compatibility-with-pjax/80/1 "2012-08-05T13:12:51Z")

</div>

Hi,

I am using Pjax ([https://github.com/defunkt/jquery-pjax/](https://github.com/defunkt/jquery-pjax/)) and so pages are loaded via ajax requests. Each time a new page is loaded a new popup is added. So if you navigate 6 pages, you end up with 6 popups.

I think the behaviour should be to remove old popups, as it is with normal requests.

You can detect a pjax request by checking the header ‘X-PJAX’, which would be set to true. If the request is a pjax request, then clear the old profiler data and just serve the new.

Thanks!

---

<div class="post-metadata">

**Author:** ![sam](https://sea2.discourse-cdn.com/flex016/user_avatar/community.miniprofiler.com/sam/32/377_2.png) [@sam](https://community.miniprofiler.com/u/sam)\
**Post date:** [August 6, 2012, 12:18am UTC](https://community.miniprofiler.com/t/compatibility-with-pjax/80/2 "2012-08-06T00:18:20Z")

</div>

yeah … totally approved though I would like a solution that works with ember and other frameworks as well

---

<div class="post-metadata">

**Author:** ![sam](https://sea2.discourse-cdn.com/flex016/user_avatar/community.miniprofiler.com/sam/32/377_2.png) [@sam](https://community.miniprofiler.com/u/sam)\
**Post date:** [August 6, 2012, 9:22pm UTC](https://community.miniprofiler.com/t/compatibility-with-pjax/80/3 "2012-08-06T21:22:55Z")

</div>

The simplest thing you can do is run:

`$('.profiler-results .profiler-result').remove();`

Just after your pjax call.

---

<div class="post-metadata">

**Author:** ![siot](https://sea2.discourse-cdn.com/flex016/user_avatar/community.miniprofiler.com/siot/32/455_2.png) [@siot](https://community.miniprofiler.com/u/siot)\
**Post date:** [August 7, 2012, 11:29pm UTC](https://community.miniprofiler.com/t/compatibility-with-pjax/80/4 "2012-08-07T23:29:19Z")

</div>

Works like a charm, thanks!
