I'm using ASP.NET and have a string array and I want to pass this array to jQuery. How can I do that?
I've tried the following but it isn't working. I have logged my array, and it's full so the array is not the problem.
<script>
var imagesSrc = '<%=images%>';
for (var i = 0; i < imagesSrc.length; i++) {
document.getElementById("image" + ((i + 1).toString())).src = "images/" + imagesSrc[i] + ".jpg";
}
</script>
I have given my elements increasing numerical ID's so they are matched by the selector "image" + ((i + 1).toString())"
One last thing if i use this it works.
document.getElementById("image" + ((i + 1).toString())).src = "images/" + "muppets" + ".jpg";