Horje
how to send json in js with post Code Example
how to send json in js with post
// Sending and receiving data in JSON format using POST method
//
var xhr = new XMLHttpRequest();
var url = "url";
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
        var json = JSON.parse(xhr.responseText);
        console.log(json.email + ", " + json.password);
    }
};
var data = JSON.stringify({"email": "hey@mail.com", "password": "101010"});
xhr.send(data);




Javascript

Related
async function fetchJson Code Example async function fetchJson Code Example
How to find the max id in an array of objects in JavaScript Code Example How to find the max id in an array of objects in JavaScript Code Example
fetch await Code Example fetch await Code Example
jquery datatable get data array Code Example jquery datatable get data array Code Example
express js limit access based on rate Code Example express js limit access based on rate Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8