WebAPI AJAX写法

1、

$(function () {
        var dataJSON = {Id:1,Title:'标题测试'};
        console.log(JSON.stringify(dataJSON));
        $.ajax({
            url: "http://localhost:53620/api/values",
            type: "Post",
            data: JSON.stringify(dataJSON),
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            success: function () {

            }
        })
    })

2、

$.ajax({
            url: "http://localhost:53620/api/values",
            type: "Post",
            data: { Id: 1, Title: '标题测试' },
            success: function () {

            }
        })

 

上一篇:acmPush模块示例demo


下一篇:关于vue告警:Strings must use singlequote