Forked from mbence/Symfony Toolbar Ajax Update
Last active
December 22, 2015 09:49
-
-
Save akcoder/6454966 to your computer and use it in GitHub Desktop.
Update the Symfony2 Web Debug Toolbar at the bottom of the page (if in debug mode). Updated from another gist which appended the contents of the wdt page. This one only updates the toolbar for the request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ajaxComplete(function (event, xhr, ajaxOption) { | |
if (xhr.getResponseHeader('x-debug-token')) { | |
$.get(window.location.protocol + '//' + window.location.hostname + '/app_dev.php/_profiler/' + xhr.getResponseHeader('x-debug-token'), function (data, status, innerXhr) { | |
var toolbar = $(data).filter('.sf-toolbarreset'); | |
$('.sf-toolbarreset').remove(); | |
$('.sf-toolbar').append(toolbar); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've updated this gist at https://gist.github.com/akcoder/6454966. My change updates the toolbar at the bottom of the page on each AJAX request instead of appending the contents to the page.