Converting XMLDocument object to String in Javascript

前端 未结 1 2019
我在风中等你
我在风中等你 2020-12-30 22:00

I want to convert XMLDocument object that I\'m getting as a response from an ajax request, to a string. I tried using

new XMLSerializer()).serializeToString         


        
相关标签:
1条回答
  • 2020-12-30 22:20

    You can do this by serializing just the root node:

    new XMLSerializer().serializeToString(xmlObject.documentElement);
    

    Demo: http://jsfiddle.net/timdown/LmWkL/

    0 讨论(0)
提交回复
热议问题