javascript - Jquery: prepend content retrieved with .load -


I am loading an SVG via AJAX with jquery:

  $ ("Body") .load ("https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg");   

Which load is fine, but changes all the contents in the body What I want to do is load first in SDG, so SVG does not change everything, but < Code> & lt; body & gt; After is inserted as the first element.

Try it out:

  $ ajax ({url: "https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg", method: "GET", data type: "html", success: function (data) {$ ("body"). Prepaid (data);}})   

If you want to get different content (such as XML / JSN elements), you have to adjust the Datat Type .

Works with your example - SVG just below the body and your #svg div

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -