Hi Anthony,
Sorry for the delayed response. Adding window.parent did the trick. Thanks.
Ian
On Wednesday, February 22, 2012 8:38:14 PM UTC-5, Anthony wrote:
>
> Maybe try:
>
> top.web2py_component("/paideia/exploring/index.load","page")
>
> or
>
> window.parent.web2py_component("/paideia/exploring/index.load","page")
>
> Anthony
>
> On Wednesday, February 22, 2012 5:18:15 PM UTC-5, monotasker wrote:
>>
>> I'm using an svg image as a navigation map, with areas that can be
>> clicked. I've got the interactivity working via an external javascript, but
>> when I try to call web2py_component() I get an error telling me that
>> web2py_component is not defined. I assumed that I could call it since this
>> script is loaded after page load. I'm not sure where the problem lies, so
>> here is how it's all set up:
>>
>> This is my js function to refresh the component (in
>> static/js/svg_interactions.js):
>>
>> function go_there(evt){
>> var tobj = evt.currentTarget;
>> var oname = tobj.getAttribute('id');
>> var the_url = "/paideia/exploring/index.load/?loc=" + oname
>> web2py_component("/paideia/exploring/index.load","page")
>> }
>>
>> This script is linked into the svg file (in the xml itself, as an
>> immediate child of the svg element) like this: <script
>> type="text/javascript" xlink:href="../js/svg_interactions.js" />
>>
>> The function go_there() is called via the "onclick" attribute of any
>> child entity in the svg file (onclick="go_there(evt)").
>>
>> The svg file is embedded in a view like this: <embed src='{{=map_image}}'
>> type='image/svg+xml' />
>>
>> Again, everything is working nicely except that svg_interactions.js
>> doesn't seem to be aware of web2py_component().
>>
>> Thanks,
>>
>> Ian
>>
>