I would like to get the value of an ASP.NET control from inside of a javascript file. I know how to do this when the javascript is on the aspx page, but not when it is in a js file. Example:
<head>
<script type="text/javascript">
alert('<%= lbl_test.Text %>'); //alerts the text of the ASP.NET label
</script>
<script type="text/javascript" src="Scripts/test.js" /> //alerts "<%= lbl_test.Text" %>
</head>
In this example test.js only has alert('<%= lbl_test.Text %>'); in it.
Is there anyway for me to reproduce the behavior in the first piece of javascript in the js file?