On my website, I am adding an svg-graphic and hoping to control other parts of the site using javascript commands that are within the svg itself. However, I am uncertain if this is achievable.
Here's the scenario: I have a world map in svg format, and I want users to be able to click on a country to trigger an ajax call that will load relevant information about that country into a div on the html page where the svg is embedded.
Currently, using "onclick="location.href='xxx'"" takes users to the respective site, but I would rather run a js function to fetch the site via ajax. The issue is that running a javascript function within the svg only seems to affect elements defined within the svg, not those outside of it.
Is it possible to manipulate elements outside of the svg through a javascript function within the svg? If so, how can this be achieved?
Best regards, Christian