Reputation: 451
I have following (simplified) code:
$("select").change(function(){
<%String lookupcode = "test";%>
var code= <%=lookupcode%>;
alert(code);
}
What is wrong with this code, why won't he alert the code?
Upvotes: 2
Views: 217
Reputation: 107317
As lookupcode
is a string variable, you need to surround the embedded variable in quotes in your javascript:
var code= '<%=lookupcode%>';
Upvotes: 7