简体   繁体   中英

Load javascript within a google map info window HTML content

I would like to load a javascript script within a google map info window HTML content but, for reasons I don't understand, the script is not loaded.

I generate my infowindow like that :

var info_window = new google.maps.InfoWindow({"content":"<script type=\"text\/javascript\" src=\"\/path\/to\/js\"><\/script>"});

I precise that the javascript path has been tested.

Is it possible to load javascript script like that? If yes, what's wrong ?

Are you using jQuery?

If so, you could add the script anywhere else in the document besides the infowindow and use .ajaxComplete() to target some script to the infowindow after the ajax call has finished.

http://api.jquery.com/ajaxComplete/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM