Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
Here’s my take on it, although a bit late, but I am working on converting all jQuery.ajax() calls to vanilla JavaScript, so why not. // alpha JS request // no jQuery // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send#Example_POST // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest var request = new XMLHttpRequest(); request.open(‘POST’, fpm_ajax.ajax_url, true); request.setRequestHeader(‘Content-Type’, ‘application/x-www-form-urlencoded;’); request.onload = function () { if (this.status >= 200 && … Read more