manipulate objects outside svg with javascript-function inside the svg

Posted by Christian Benke on Stack Overflow See other posts from Stack Overflow or by Christian Benke
Published on 2010-06-10T20:05:56Z Indexed on 2010/06/10 20:52 UTC
Read the original article Hit count: 652

Filed under:
|
|
|
|

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

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about AJAX