Create XML in Javascript

后端 未结 7 765
慢半拍i
慢半拍i 2020-11-28 07:16

I\'m wondering, is it possible to create an XML file with some data in Javascript? I have the data stored in variables.

I\'ve googled around a bit and it doesn\'t see

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 07:33

    Only works in IE

     $(function(){
    
            var xml = 'bar'; 
    
            var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
            xmlDoc.async="false";
            xmlDoc.loadXML(xml);
    
            alert(xmlDoc.xml);
    
        });
    

    Then push xmlDoc.xml to your java code.

提交回复
热议问题