Compatibility with Pjax


#1

Hi,

I am using 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!


#2

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


#3

The simplest thing you can do is run:

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

Just after your pjax call.


#4

Works like a charm, thanks!