ANkesh Kumar

ANkesh Kumar

  • NA
  • 17
  • 929

How to upload java-script file dynamical

Jun 17 2015 7:41 AM
<script>
var oHead = document.getElementsByTagName('HEAD').item(0);
var oScript = document.createElement("script");
var oHead = document.getElementsByTagName('head').item(0);
var lang = 'ca';
var file = 'js/languages/jquery.validationEngine-' + lang + '.js';
oScript.type = "text/javascript";
oScript.src ='{{ URL::asset('/') }}' + file;
alert(oScript.src);
oHead.appendChild(oScript);
</script>
Whats wrong in this. I am getting correct path in alert(oScript.src);

Answers (4)