I want to pass a json string to a Javascript function, and JSON generated dynamically. but after pass the JSON parameter in function it double quotes encode with "e;. I am using C# MVC 4.0 here is my code :-
string strAllImages = "[";
foreach (var images in Model.PostsImageList)
{
if (strAllImages.Trim() != "[")
{
strAllImages = strAllImages + ",";
}
strAllImages = strAllImages + "'~/postImages/" + images.Image_Post_URL + "'";
}
strAllImages = strAllImages + "]";
<script language="javascript" type="text/javascript">
$(document).ready(function(){ // on document load
$("#thumbsliderdiv").imageSlider({ //initialize slider
'thumbs': @strAllImages,
'auto_scroll':true,
'auto_scroll_speed':4500,
'stop_after': 2, //stop after x cycles? Set to 0 to disable.
'canvas_width':700,
'canvas_height':500 // <-- No comma after last option
})
});
</script>