I am trying to access <s:property value="Names"/>
values in my JavaScript but getting error. Here Names is a list. I tried to put <s:property value="Names"/>
in variable also but still its not converting to array. Not sure where I am going wrong . I have put in my JavaScript in JSP page. The evaluated value of <s:property value="Names"/>
is coming as [abc,xyz]
.
Help is appreciated!
Code:
<script type="text/JavaScript">
$(document).ready(function() {
var temp= new Array();
temp=<s:property value="Names"/>;
});
</script>
While debugging it shows:
<script type="text/JavaScript">
$(document).ready(function() {
var temp= new Array();
temp=[xyz,abc];
});
</script>
Its gives error that xyz is undefined.