views:

583

answers:

1

Is it possible to do something like this:

<% Dim foo as string = "bar" %>

<script type="text/javascript">
    var baz = <%=foo %>
</script>

Where the <script> tag is embedded on my index page?

+7  A: 

Yes, but make sure you put quotes around it and a semicolon:

var baz = '<%=foo %>';
Kon
perfect, thank you
Anders