This is possible, you just need to loop through the razor collection
<script type="text/javascript">
var myArray = [];
@foreach (var d in Model.data)
{
@:myArray.push("@d");
}
alert(myArray);
</script>
More Related Contents:
- jQuery: How to traverse / Iterate over a list of object
- Concat two arrays But concat is not working
- Using Razor within JavaScript
- How to pass json POST data to Web API method as an object?
- ASP.NET MVC 3 Razor: Include JavaScript file in the head tag
- ASP.NET MVC implement custom validator use IClientValidatable
- Calling ASP.NET MVC Action Methods from JavaScript
- Is it OK to put JavaScript in Partial Views
- Does Angular routing template url support *.cshtml files in ASP.Net MVC 5 Project?
- Razor/JavaScript and trailing semicolon
- ASP.NET MVC Partial view ajax post?
- Using Razor, how do I render a Boolean to a JavaScript variable?
- How can I create a two dimensional array in JavaScript?
- Find a value in an array of objects in Javascript [duplicate]
- Compare JavaScript Array of Objects to Get Min / Max
- JavaScript – Difference between Array and Array-like object
- How do you put an image file in a json object?
- Create a and fill it based on a passed array
- How do I remove an object from an array with JavaScript? [duplicate]
- How to check if array is empty or does not exist? [duplicate]
- How to check whether multiple values exist within an Javascript array
- Converting JSON object to CSV format in JavaScript
- Importing data from multiple csv files in D3
- jQuery UI autocomplete with item and id
- Javascript Set vs. Array performance
- Generate permutations of JavaScript array [duplicate]
- Populate nested object from array?
- What is the concept of Array.map?
- javaScript: Can a comma occur after the last set of values in an array?
- How do I create a MVC Razor template for DisplayFor()