Hello,
what I try to do is to create a map interface with AJAX. Therefore,
I''ve
got a JSP page, which fetches a dynamic JavaScript from a Servlet and
builds it into the page by updating (Ajax.Updater) a div-tag.
1.) The JavaScript in the Servlet works if I just copy and paste the
output of the Servlet into an HTML page.
2.) The fetched JavaScript is executed, but an exception is thrown.
2a.) First, the ''onsuccess'' function is invoked.
2b.) Afterwards, the ''onexception'' function is invoked by
Ajax.Updater.
What would that mean? That the data was fetched successfully, but the
JavaScript wasn''t carried out successfully? The e.statusText of the
exception returns "UnknownException".
2c.) Do I invoke the JavaScript function in the right way?
My JSP/HTML page basically looks like that:
<html>
<head>
<script src="javascript/prototype.js"
type="text/javascript"></script>
<script src="javascript/scriptaculous.js"
type="text/javascript"></script>
<script
src="http://api.visual.paginegialle.it/tcolnew/mapsapi/pgMap.js?id=abc"
type="text/javascript"></script>
<script type="text/javascript"
language="javascript">
var map1;
var oncompletefunc = function()
{
alert(''Great - Complete!!'');
}
var onsuccessfunc = function()
{
alert(''Great - Success!!'');
}
var onfailurefunc = function()
{
alert(''Something went wrong - Failure'');
}
var onexceptionfunc = function()
{
alert(''Something went wrong - Exception'');
}
function btnOnclick(object)
{
new
Ajax.Updater(''mapDiv'',''http://localhost:8080/WikiCity/DataHandler?mapWidth=600&mapHeight=450'',{method:''get'',asynchronous:true,evalScripts:true,onSuccess:onsuccessfunc,onFailure:onfailurefunc,onException:onexceptionfunc,onComplete:oncompletefunc});
}
</script>
<title>Test1</title>
</head>
<body>
<div id="mapDiv">
Hello Test... please disappear!
</div>
<button onclick="btnOnclick(this)">drawMap</button>
</body>
</html>
The fetched JavaScript looks like that (map1 is defined in the HTML-Head
as a global variable):
<script type="text/javascript" language="javascript">
drawMapFunc = function(){
map1 = null;
map1 = new
PGMappy({nameContainer:''mapcontainer'',lon:12.441515,lat:41.83378,mapWidth:600,mapHeight:450,z:0});
map1.setZoom(6);
map1.addCompass();
var point;
point = new
PGPoint({z:1000,lon:12.47862,lat:41.82651,html:''<div><img
src=http://immagini.paginegialle.it/27/63/37/05/0/276337050_LG.gif></img></div>'',opened:{name:
''BANCA FIDEURAM spa'',info: [''Banche ed istituti di
credito e
risparmio'',''31, pl. G. Douhet, Roma
(RM)'',''www.paginegialle.it/fideuram'',''email:
'']}});
map1.pointAdder(point);
}
drawMapFunc();
</script>
Thank you very much for your help already in advance,
Bernd.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---