I have a external JS function defined below held within test.js
function InvokeSupport(ID, TimeStamp, Hash) {
var sUrl = '<%= System.Configuration.ConfigurationManager.AppSettings["URL"] %>' + "?uid=" + ID + "&t=" + TimeStamp + "&hash=" + Hash;
window.open(sUrl, "Support", null, false);
}
On my asp.net page I have the following.
<script type="text/javascript" src="../../../scripts/test.js"></script>
<div class="User">
<span class="UserName"><button type="submit" title="Help!" onclick="InvokeSupport()" class="Class1"></button> </span>
</div>
THE PROBLEM
The InvokeSupport function is coming back as undefined and fails to work unless I place the function on the ASP.net page where it works. The link to the javascript file is right as I have other files in the same repository working fine.
Any idea what Im doing wrong?
Why are you using ASP.NET script tags in external js file?
Pass the data from configuration as and additional parameter to javascript function.
Also, you can use Firebug and Chrome devTools which can show you a place of error occured