Reputation: 3962
Aside from the obvious use of jQuery, is there a difference between calling a script into a page with:
<script src="script.js">
vs
ajax({
url: 'script.js,
dataType: 'script'
})
Upvotes: 3
Views: 341
Reputation: 822
When you are using an ajax request you are expecting an answer (which in this case is the file as string), where as when you add a script tag it will try to run the file or add its functions to the global scope.
see here in datatype
Upvotes: 3