|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
including external apis
hello,
I am a bit new to javascript; I mostly deal with server-side applications so im not sure what i am doing. I have written a bunch of javascript in my hmtl pages that use an external api (specifically google maps). I decided to clean up my web app and put all my scripts into a .js file, but now it does not work. I can only guess that it is because it can't find the google map objects. What do I say in the .js so that it knows where to find the api? i used to say something like this in the my html pages: <script src="http://maps.google.com/maps"></script> <script> //My javascript stuff .... </script> which worked fine and now i say: <script src="http://maps.google.com/maps"></script> <script src="functions.js"></script> and now it doesn't work. This seems like a common thing you would want to do and i am surprised i couldn't find the answer on my own. Any help is appreciated. Thanks |
|
#2
|
|||
|
|||
|
Coding it like this:
<script src="http://maps.google.com/maps" type="text/javascript"></script> <script src="functions.js" type="text/javascript"></script> will work fine -- provided that you do not include any HTML (like script tags or HTML comment tags) at the beginning and ending of your .js file. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|