user403295
user403295

Reputation: 826

calling one javascript from another one

I have got a question. Is that possible to call a javascript from another one. If it is, can anyone tell me how to do that?

What I want to achieve is basically: I have got a php page. I do not want to put all the code here. It contains google map api js. I have written classes like Marker and MarkerManager. I want to keep them in another javascript file so I can call them from php.

To do this, I need to call google map api js from the js I have written which includes Marker and Manager class.

mytest.js (call google map api js) Marker MarkerManager

main.php (call mytest.js)

I hope this explains what I want to do.

Thanks in advance.

Upvotes: 0

Views: 390

Answers (2)

jfriend00
jfriend00

Reputation: 707416

Just include multiple script files in your page in whatever order they need to be run:

<script type="text/javascript" src="mytest.js"></script>
<script type="text/javascript" src="xxxxx.js"></script>

Upvotes: 0

James Montagne
James Montagne

Reputation: 78650

Simply include your file after the map js file and you should be fine.

Upvotes: 1

Related Questions