Tho*_*ire 3 javascript jquery symfony
我目前正在构建一个完全支持ajax页面加载的应用程序.初始页面加载后,浏览网站只会加载内容而不是标题或菜单.
整个应用程序运行良好,但我想刷新Web Profiler工具栏以显示最后的ajax请求信息.
我从响应头获取了xdebug令牌,我正在尝试扩展javascript部分以替换工具栏的当前内容,但我还没有成功.
我怎么能做到这一点?我应该注意哪些具体内容?
我最终"反向设计"了load
对象的方法,Sfjs
并证明它的工作非常好.
这是解决方案
// Query the proper URL
$.get('/my-url', function (data, status, xhr) {
// Get the xdebugToken from response headers
var xdebugToken = xhr.getResponseHeader('X-Debug-Token');
// If the Sfjs object exists
if (typeof Sfjs !== "undefined") {
// Grab the toolbar element
var currentElement = $('.sf-toolbar')[0];
// Load the data of the given xdebug token into the current toolbar wrapper
Sfjs.load(currentElement.id, '/_wdt/'+ xdebugToken);
}
})
Run Code Online (Sandbox Code Playgroud)