Awais
Awais

Reputation: 37

How get xml string from svg file?

var jqxhr = $.get('/download.svg', function () {

                })
         .done(function (data) {
              alert("done");
           })

I have a svg file saved in my local system and i got this file through jquery get which is working fine and returning a data document. I need to get xml string of that svg file. How can i get that ?

Upvotes: 0

Views: 806

Answers (1)

user1438038
user1438038

Reputation: 6059

Set the dataType argument to xml when calling get():

$.get('/download.svg', function(svg) {
   console.log( svg );
}, 'xml');

With older jQuery versions, you might need to use text as data type:

$.get('/download.svg', function(svg) {
   console.log( svg );
}, 'text');

Upvotes: 1

Related Questions