In my case the $.getJSON is not working (not sending any request). So i made a solution:
const xhr = new XMLHttpRequest();
xhr.open('GET', '/mcgi?action=captcha');
xhr.cache = false;
xhr.setRequestHeader("Pragma", "no-cache");
xhr.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
xhr.setRequestHeader("Expires", 0);
xhr.setRequestHeader("Last-Modified", new Date(0).getTime());
xhr.setRequestHeader("If-Modified-Since", new Date(0).getTime());
xhr.responseType = 'json';
xhr.send();
xhr.onload = function() {
const data = xhr.response;
$("#captcha_img").attr("src", data.image);
$("#token").attr("value",data.token);
$("#getcaptcha-button").prop("disabled", false).removeAttr("style");
};
Open the console (F12), paste this code and hit enter. Captcha should appear.