jquery ajax post json asp.net core code example

Example: jquery ajax post json asp.net core

1234567891011121314151617181920212223             // form ajax with multiple json complex types            $('#btnFormAjaxJsonMultipleComplexTypes').on('click', function () {                 var joe = { FirstName: 'Joe' };                var jane = { FirstName: 'Jane' };                var data = { one: joe, two: jane };                 $.ajax({                    url: '@Url.Action("CreateAjaxFormJsonMultipleComplexType")',                    type: 'POST',                    beforeSend: function (xhr) {                        xhr.setRequestHeader("RequestVerificationToken",                            $('input:hidden[name="__RequestVerificationToken"]').val());                    },                    dataType: 'json',                    contentType: 'application/json; charset=utf-8',                    data: JSON.stringify(data)                }).done(function (result) {                    alert(result.Count)                });             });<div class="open_grepper_editor" title="Edit & Save To Grepper"></div>

Tags:

Cpp Example