manipulate objects outside svg with javascript-function inside the svg
- by Christian Benke
Hello!
I'm embedding a svg-graphic on my website and i'd like to manipulate the rest of the website with javascript-commands which are in the svg - though i'm not sure if this is possible.
Let me elaborate:
I've got a worldmap in svg, i want to click on a country and this click should run an ajax-call and load relevant information of this country into a div in the html site where the svg is embedded.
"onclick="location.href='xxx'"" redirects to the respective site which is fine, but i'd prefer to run a js-function that fetches the site with ajax - but running a javascript-function in the svg only seems to work for functions and elements defined in the svg, not outside of it.
Is it basically possible to manipulate anything outside the svg through a js-function in the svg? How?
Regards
Christian