[mapserver-users] RE: javascript in html templates

KenHeer1 kenheer1 at gmail.com
Wed Jan 25 12:49:54 EST 2012


I hope you might be able to help me out a little further, I am still a little
new to this.

I'm using Openlayers to perform my getfeatureinfo request. The Mapserver
Template file that is returned *is* my ajax response, right?

That response is a full html page with the javascript in it. If I understand
this right, nothing in a <script> tag will execute on this page, is that
also correct?

I am vagely familiar with jQuery and ExtJs but everything I've looked at
seems to require involvement when the initial request is sent, not just
handling the html response that's returned. Even when I incorporate a simple
jQuery alert into the response page, it's still in the script tag and
doesn't get fired. It seems like my problem starts because I'm feeding the
completed mapserver template html file straight to the openlayers function
and then using openlayers.loadURL and the openlayers popups.

Instead of using a popup, if I posted the response to a div on the original
page I believe I'd be able to use some of the examples that I found online
to handle the new, ajax delivered content. But since it's a popup that's
essentially a separate html page, that won't work, right?




Lime, Steve D (DNR) wrote
> 
> The answer here depends on your development framework. It's not a
> MapServer issue. By default the browser won't execute javascript in the
> response and you have to work around that. Frameworks like ExtJS provide
> options to do this via their AJAX classes. Check your framework's (e.g.
> jQuery, Dojo or whatever) docs for more information. There are also
> solutions on the web, search for something like "executing javascript in
> ajax response".
> 
> Steve
> 
> 


--
View this message in context: http://osgeo-org.1560.n6.nabble.com/javascript-in-html-templates-tp4336706p4338841.html
Sent from the Mapserver - User mailing list archive at Nabble.com.


More information about the mapserver-users mailing list