1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 05:18:32 +01:00

Use fetch instead of jQuery ajax (#630)

This commit is contained in:
Barry vd. Heuvel 2024-03-20 13:35:41 +01:00 committed by GitHub
parent 42beef04ff
commit 29c8b9c942
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 14 deletions

View File

@ -188,13 +188,19 @@ if (typeof(PhpDebugBar) == 'undefined') {
},
ajax: function(data, callback) {
$.ajax({
dataType: 'json',
url: this.get('url'),
data: data,
success: callback,
ignoreDebugBarAjaxHandler: true
});
var url = this.get('url');
if (data) {
url = url + '?' + new URLSearchParams(data);
}
fetch(url, {
method: "GET",
headers: {
"Accept": "application/json",
},
})
.then((data) => data.json())
.then(callback);
}
});

View File

@ -595,7 +595,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
if (e.xdebug_link) {
if (e.xdebug_link.ajax) {
$('<a title="' + e.xdebug_link.url + '"></a>').on('click', function () {
$.ajax(e.xdebug_link.url);
fetch(e.xdebug_link.url);
}).addClass(csscls('editor-link')).appendTo(header);
} else {
$('<a href="' + e.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header);

View File

@ -130,7 +130,7 @@
var header = $('<span title="Filename" />').addClass(csscls('filename')).text(stmt.xdebug_link.filename + ( stmt.xdebug_link.line ? "#" + stmt.xdebug_link.line : ''));
if (stmt.xdebug_link.ajax) {
$('<a title="' + stmt.xdebug_link.url + '"></a>').on('click', function () {
$.ajax(stmt.xdebug_link.url);
fetch(stmt.xdebug_link.url);
}).addClass(csscls('editor-link')).appendTo(header);
} else {
$('<a href="' + stmt.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header);

View File

@ -23,7 +23,7 @@
if (tpl.xdebug_link) {
if (tpl.xdebug_link.ajax) {
$('<a title="' + tpl.xdebug_link.url + '"></a>').on('click', function () {
$.ajax(tpl.xdebug_link.url);
fetch(tpl.xdebug_link.url);
}).addClass(csscls('editor-link')).appendTo(header);
} else {
$('<a href="' + tpl.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header);