How to pass parameters to JavaScript from scripting page?
How to pass parameters to JavaScript from scripting page?
using ASP.NET C# please
Re: How to pass parameters to JavaScript from scripting page?
Parameters are passed to the server side and JavaScript runs in the client side and it is an interesting topic on how to do it. See following sample ASP.Net code. Note that the long and lat variables are set from the parameters that are passed to the ASP page (I assume there are two parameters named long and lat are passed to ASP page).
Enjoy!
Code: Select all
<html>
<head>
<script type="text/javascript">
function myFunction(){
var long = <% Response.Write(Request.QueryString("long")) %>;
var lat = <% Response.Write(Request.QueryString("lat")) %>;
alert("long " + long + " lat " + lat);
}
</script>
</head>
<body>
<!-- HTML Page code goes here -->
</body>
</html>