sagamon
sagamon

Reputation: 27

HTML Form to XML File done, how do I post XML File to webserver?

I've created a form based on edits from another post I found on here, where the HTML form outputs in XML format once the submit button has been clicked. How do I now take this data once transformed and post it to a third-party server via HTTP POST instead of outputting on html?

My code in its current form can be found here. http://jsbin.com/iyokay/15/edit

My knowledge of Javascript isn't great so any code based help would be greatly appreciated.

Upvotes: 0

Views: 572

Answers (1)

Adil Shaikh
Adil Shaikh

Reputation: 44740

You can send your xml with ajax,

$("#DownloadButton").on("click",function(){
     xml = update();
     $.ajax({
       url : "saveXml.php",
       type:"post",
       data : xml,
       contentType: "text/xml",
       success : function(response){
          alert("xml saved successfully");
       }  
     });
});

replace this $("#DownloadButton").click(update); with above code

Upvotes: 1

Related Questions