1

How to read javascript file as text file and prevent code to run multiple time

index.js

  version = "1.001";
  alert("JS run");
  ... other code ...

and I have html that use index.js
I try to read index.js by using

jQuery.get("js/index.js",function(data){ 
    var currentVersion = data.split("\n")[0].split('"')[1];
}

I can read text as I want but alert("JS run") and other code inside also run after I use this code.

hsgu
  • 834
  • 4
  • 9
  • 18

0 Answers0