My current setup involves an ajax call structured like this:
var data = {"name":"John Doe"} $.ajax({ dataType : "jsonp", contentType: "application/json; charset=utf-8", data : JSON.stringify(data), success : function(result) { alert(result.success); // result is an object which is created from the returned JSON }, });
However, I am now looking to convert it into JavaScript's XmlHttpRequest. I understand the basic syntax, but I am unsure how to specifically translate this jQuery ajax functionality into XmlHttpRequest.
In particular, I am seeking guidance on how to specify the dataType when using XmlHttpRequest.