Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

dotnet core ajax post of an ojject site:stackoverflow.com

$(document).ready(function () {
    var things = [
        { id: 1, color: 'yellow' },
        { id: 2, color: 'blue' },
        { id: 3, color: 'red' }
    ];      

    things = JSON.stringify({ 'things': things });

    $.ajax({
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        type: 'POST',
        url: '/Home/PassThings',
        data: things,
        success: function () {          
            $('#result').html('"PassThings()" successfully called.');
        },
        failure: function (response) {          
            $('#result').html(response);
        }
    }); 
});


public void PassThings(List<Thing> things)
{
    var t = things;
}

public class Thing
{
    public int Id { get; set; }
    public string Color { get; set; }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: enable network request in react native 
Javascript :: character to ascii javascript 
Javascript :: eslint no-param-reassign 
Javascript :: js loop over object 
Javascript :: nodejs fs directory exists 
Javascript :: javascript change table row color based on value 
Javascript :: how to get id from url in javascript 
Javascript :: ngfor select angular 
Javascript :: array comprehension javascript 
Javascript :: angular generate component 
Javascript :: js console log without spaces 
Javascript :: node exec child_process ssh command password 
Javascript :: drupal 8 node has field 
Javascript :: find vowel & consonants in a string java script 
Javascript :: object loop in javascript 
Javascript :: clear input field data on button click 
Javascript :: how to get aria expanded value in javascript 
Javascript :: discord bot javascript remove user data in array 
Javascript :: reactjs download file axios 
Javascript :: js datetime now 
Javascript :: border bootstrap 
Javascript :: stripe npm 
Javascript :: confirm before leaving page javascript 
Javascript :: javascript play sound on click 
Javascript :: angular how to get previous state 
Javascript :: js remove space before string 
Javascript :: jquery get document height 
Javascript :: how to get data from user in javascript 
Javascript :: javascript take any number of arguments 
Javascript :: slick on init 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =