Answers for "jquery ajax post json asp.net core"

C++
0

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>
Posted by: Guest on February-09-2021

Browse Popular Code Answers by Language