Michael Kniskern
Michael Kniskern

Reputation: 25270

Add a reference to a .js file in a javascript file?

What is the correct syntax for adding an external reference to a JavaScript file (.js) within another JavaScript file?

Upvotes: 3

Views: 7983

Answers (3)

AbstractProblemFactory
AbstractProblemFactory

Reputation: 9811

I suppose you could load content of file via ajax and use eval().

Upvotes: 1

woodscreative
woodscreative

Reputation: 1031

Alternatively store all your .js files in a php file.

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

php:

<?php
require 'js/myjs1.js';
require 'js/myjs2.js';
?>

Upvotes: 1

SLaks
SLaks

Reputation: 887469

There isn't any.

You can add a <script> block to the document, but it will execute asynchronously.

Upvotes: 4

Related Questions