Is it possible to convert jstl/JSP variables to javascript variables?
Here is the JSTL:
<c:forEach var="responseString" items = "${responseString}">
<c:out value="${responseString.response}" />
</c:forEach>
I want to transfer the value inside ${responseString.response} to a javascript var response
HERE is the javascript function:
directionsService.route(request, function(response, status)
I tried this tutorial;
var response = {
<c:forEach var="responseString" items = "${responseString}">
<c:out value="${responseString.response}" />
</c:forEach>
}
Obviously it didn't work, I kind of screwed it up, please help.
Added info, ${responseString.response} is actually JSON
, I just converted it to String
:
{"routes": [{"bounds" : {"northeast":{"lat":14.650,"lng":121.050610}, "status":"OK"}
It's a deeply nested JSON
.