I need to realize the following scenario: I have a html page, where is a button and some textboxes. When I click the button i want to create an xml from the textboxes data and send this xml to the server, than server returns this xml back as an attachment and I will have a Save As dialog and I can save this xml locally. I have the following jquery function which send the xml to the server:
function GetXml() {
var xmlData = '{"xml": "<test>test</test>"}';
var contentType = "application/json";
var eDoc = "";
$.ajax({
type: 'POST',
url: 'http://localhost/xmlservice.svc/rest/GetXmlToSave',
data: xmlData,
contentType: contentType,
success: function (result) {
alert(result);
},
error: function (result) {
alert(result);
},
async: false,
});
return result;
}
But i don't know hot to force Save As dialog from javascript with the returned xml from the server.
I can realize it with the classic submit button:
<form action='http://localhost/xmlservice.svc/rest/GetXmlToSave' method="POST" runat="server" >
<input type="submit"/>
</form>
But in this scenario I cannot create xml on the client side.
Is it possible to force Save As dialog from the javascript?
thanks.