Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery loop through model list

@model StudentSearchResult
<script type="text/javascript">
    var students = @Html.Raw(Json.Encode(Model.Students));
    // students is a javascript array that will look like this:
    // students = [{"FirstName":"fn1","LastName":"ln1"}, {"FirstName":"fn2","LastName":"ln2"}, ...];
    for (var i = 0; i < students.length; i++) {
        var student = students[i];
        alert('FirstName: ' + student.FirstName + ' LastName:' + student.LastName);
    }
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: convert string to number 
Javascript :: js onclick add table row 
Javascript :: copy array 
Javascript :: how to scroll element in javascript 
Javascript :: redirect router v6 
Javascript :: axios response error interceptor 
Javascript :: regexp object 
Javascript :: javascript invert number 
Javascript :: mongoose query document 
Javascript :: how to convert string into int js 
Javascript :: class in js 
Javascript :: how to upload file in node js 
Javascript :: find all the prime numbers in the array 
Javascript :: events node.js 
Javascript :: instance in javascript 
Javascript :: url enocde in javascript 
Javascript :: arjs marker+location 
Javascript :: findPotentialLikes javascript 
Javascript :: how to make navbar links scroll to component react 
Javascript :: javascript Arrow Function as an Expressio 
Javascript :: date methods javascript 
Javascript :: status role discord.js 
Javascript :: JavaScript / jQuery HTML Elements 
Javascript :: OpenTok Create Session 
Javascript :: set rotation and origin phaser 
Javascript :: phaser add frames to existing animation 
Javascript :: complex expression in programming 
Javascript :: Datatable js Search Server side after time or word length 
Javascript :: condition rendering using if-else 
Javascript :: string concat in js 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =