dotnet core ajax post of an ojject site 3astackoverflow com

Solutions on MaxInterview for dotnet core ajax post of an ojject site 3astackoverflow com by the best coders in the world

showing results for - "dotnet core ajax post of an ojject site 3astackoverflow com"
Daniel
24 Jul 2016
1$(document).ready(function () {
2    var things = [
3        { id: 1, color: 'yellow' },
4        { id: 2, color: 'blue' },
5        { id: 3, color: 'red' }
6    ];      
7
8    things = JSON.stringify({ 'things': things });
9
10    $.ajax({
11        contentType: 'application/json; charset=utf-8',
12        dataType: 'json',
13        type: 'POST',
14        url: '/Home/PassThings',
15        data: things,
16        success: function () {          
17            $('#result').html('"PassThings()" successfully called.');
18        },
19        failure: function (response) {          
20            $('#result').html(response);
21        }
22    }); 
23});
24
25
26public void PassThings(List<Thing> things)
27{
28    var t = things;
29}
30
31public class Thing
32{
33    public int Id { get; set; }
34    public string Color { get; set; }
35}