What am I doing wrong? Why is console.log not working when I enter the variable via JSP? The following error appears:
index.jsp: 1 Uncaught SyntaxError: missing) after argument list
at eval (<anonymous>) at jquery-1.7.2.min.js:2
The following is the code below:
<select id="cargo" name="cargo">
<option value=""></option>
<%
List<String> cargos = FuncApp.obterCargos();
String sListaCargo;
for(int i = 0; i < cargos.size(); i++) {
sListaCargo = cargos.get(i);
%>
<script>
console.log("sListaCargo:" + <%= sListaCargo %> );
</script>
<option value='<%= sListaCargo %>' <%= (sCargo.equals(sListaCargo)) ? "selected='selected'" : "" %>> <%= sListaCargo %> </option>
<%
} //fecha for
%>
</select>