mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
26 lines
788 B
JavaScript
26 lines
788 B
JavaScript
function crudAjax(params, url, type = 'GET', callback = () => {}, async = false, options = {}) {
|
|
return $.ajax({
|
|
...{
|
|
type: type,
|
|
data: params,
|
|
async: async,
|
|
url: url,
|
|
success: function (response) {
|
|
callback(response);
|
|
},
|
|
},
|
|
...options
|
|
});
|
|
}
|
|
|
|
function getUserNavMenu(html, element) {
|
|
crudAjax({}, '/ajax/get-user-info', 'GET', function (callback) {
|
|
if (callback['userName']){
|
|
element.html(html);
|
|
$(element).find('.addBlock').html(callback['addBlockHtml']);
|
|
$(element).find('.username').html(callback['userName']);
|
|
$(element).find('.profile-img').attr('src', `${callback['profileImg']}`);
|
|
}
|
|
})
|
|
}
|