0

How do I add Script in the (head) by jquery

Experimented with this, but did not succeed

$("head").append("<script type='text/javascript' src='http//aps.js'></script>");

How do I add tag

<script></script>

in head ??

fessal
  • 1
  • 2
    Why do you want to add a script block to the head of an already-loaded page? What do you think this will achieve? – Paul Turner May 28 '13 at 11:32
  • If you want to load dynamically JS files, take a look at: http://stackoverflow.com/questions/5751620/ways-to-add-javascript-files-dynamically-in-a-page – Alvaro May 28 '13 at 11:34

1 Answers1

0

Try that:

$(function(){
    var _Script = document.createElement('script');
    _Script .type = 'text/javascript';
    _Script .src = "http//aps.js";
    $("head").append(_Script);
});

--- EDIT

Well, on second thought - why do you exactly need to insert script in the head?

Kamil T
  • 2,204
  • 1
  • 15
  • 25