Importing JS file with AJAX does not work
I had some JavaScript code which was working but when I tried to put it into its own file, it stopped working :)
Here is the url I use: http://www.comehike.com/hikes/javascript_library.js
Any idea why now it doesn't work? To test that it is worki开发者_高级运维ng, try hitting this url to see if the google map shows up like it would if the JS was on the page. http://www.comehike.com/hikes/hike_carpool.php?hike_id=125
Thanks, Alex
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=true">
</script>
<SCRIPT LANGUAGE="JavaScript" SRC="javascript_library.js"> </SCRIPT>
place the google map api before your javascript_library.js (aka your map scripts)
and remove the script tag from your javascript_library.js
Don't put HTML into your JavaScript files.
<script type="text/javascript">
</script>
↑ Bad!
精彩评论