Skip to content

Instantly share code, notes, and snippets.

@akcoder
akcoder / Symfony Toolbar Ajax Update
Last active December 22, 2015 09:49 — forked from mbence/Symfony Toolbar Ajax Update
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);
});
}
});