A
A
Alexey Lebedev2014-03-05 15:25:54
JavaScript
Alexey Lebedev, 2014-03-05 15:25:54

jquery-loading: how to correctly insert from xml?

There is an svg file. The file is inserted like this:

$.get('map.xml?1', {}, function (data) {
       $("#map_action").after(data);					
  });

The domain is the same.

Error:
Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node': Nodes of type '#document' may not be inserted inside nodes of type '#document-fragment'.

Fragment of xml file (beginning):
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="//www.w3.org/2000/svg" xmlns:xlink="//www.w3.org/1999/xlink" version="1.1" width="809px" height="400px" >
  <g id="viewport" transform="matrix(0.6159000992774963,0,0,0.6159000992774963,64.81729060587531,20.48831235851503)">


You need a cross-browser insert that works without additional libraries (only jquery).

It was not possible to find a modern solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Kolontenko, 2015-12-10
@enep

r/'map.xml?1'/'map.xml?1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question