I'm making an AJAX request. The returned response
is a XML.
How can I let the user save the response
as a XML file locally on success
?
$.ajax({
type: "POST",
url: url,
data: JSON.stringify(myJson),
contentType: "application/json",
dataType: format,
success: function(response)
{
console.log("Exported JSON: " + JSON.stringify(myJson));
console.log(response);
jQuery.parseXML(response);
},
error: function()
{
console.log(arguments);
alert("Export process failed.");
}
});
The format
in this case is xml
.