2

I want to send the following data in POST XMLHttpRequest method.

Data to be sent: var data = {xx:"value",user:{password:"pass",username:"xyz"}};

Code used:

var xmlhttp = new XMLHttpRequest();
var data = {xx:"value",user:{password:"pass",username:"xyz"}};
data = JSON.stringify(data);
xmlhttp.open("POST",Url,true);
xmlhttp.onreadystatechange = function() {
    if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        alert(xmlhttp.responseText);
    }
}
xmlhttp.send(data );

Result: Getting "xx" is missing.

Kindly help me to resolve this issue.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.