0

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.

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

This answer embarrassed me. Something easy but I did not know. It worked. Many thanks.
0

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.