Pure JavaScript Send POST Data Without a Form
You can send it and insert the data to the body: var xhr = new XMLHttpRequest(); xhr.open(“POST”, yourUrl, true); xhr.setRequestHeader(‘Content-Type’, ‘application/json’); xhr.send(JSON.stringify({ value: value })); By the way, for get request: var xhr = new XMLHttpRequest(); // we defined the xhr xhr.onreadystatechange = function () { if (this.readyState != 4) return; if (this.status == 200) … Read more