Skip to content

Instantly share code, notes, and snippets.

@akcoder
Forked from mbence/Symfony Toolbar Ajax Update
Last active December 22, 2015 09:49
Show Gist options
  • Save akcoder/6454966 to your computer and use it in GitHub Desktop.
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.
$(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);
});
}
});
@akcoder
Copy link
Author

akcoder commented Sep 5, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment