开发者

Importing JS file with AJAX does not work

开发者 https://www.devze.com 2023-02-13 04:47 出处:网络
I had some JavaScript code which was working but when I tried to put it into its own file, it stopped working :)

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消