I have an asp website and am trying to automatically generate some javascript. I have an ashx file that generates the javascript and then I would like to like to this javascript in a href.
I have seen it done on other websites but can’t work out how its done.
The ashx file called ‘Hello.ashx’ outputs something like
alert("Hello World");
I am trying to execute this as below
<a href="Hello.ashx">Text</a>
How is this done? Is is actually possible or are other websites using some trick?
Your help is greatly appreciated
You want to load the javascript file when the anchor is clicked:
If you’re using jQuery a better approach is:
To load it once: