$("#view").on("show.bs.modal", function (e) {
var uuid = $(e.relatedTarget).data("id");
var target = document.querySelector("#kt_block_ui_1_target");
var blockUI = new KTBlockUI(target,
{
message: "<div class="blockui-message"><span class="spinner-border text-primary"></span> Loading...</div>",
});
$.ajax({
url: ""xxxxxxxx,
method: "GET",
dataType: "JSON",
beforeSend: function () {
blockUI.block();
},
same me
Hi,
Please declare the blockUI variable in the global scope in order to access it in the callback function.
So you just need to declare var blockUI;
outside the modal callback functions and use it inside the callback.
For more info please check the KTBlockUI documentation here.
Regards,
Sean
Hey Sean,
I have dynamically created elements (repeater) where I want to use blockUI. So defining the blockUI outside doesn't work here.
I run it inside a listener filter_data_select.addEventListener('change', handle_change()) but it doesn't work if it's called inside listener.
Looks like the problem is about defining KTBlockUI on the same element multiple times. I fixed the issue by checking if the instance is created first then defining if the result is null.
var blockUI = KTBlockUI.getInstance(target);
Can you describe more clearly the code you use? I had the same problem with
blockUI.realease();
success: (response) => {blockUI.realease();}