📜  jquery ajax post json asp.net core - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:57.558000             🧑  作者: Mango

代码示例1
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)                });             });