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
Post a Comment