$ .ajax(...类型:"POST",dataType:"JSON"...)和$ .post(...,"JSON")之间的区别是什么?

Jos*_*eph 0 ajax jquery post json

我可以使用$ .post()获取返回json字符串解析,但不能获得$ .ajax().

{"result": "success", "id": "1"}
Run Code Online (Sandbox Code Playgroud)

Mat*_*off 8

帖子的实际代码没有:

post: function( url, data, callback, type ) {
    // shift arguments if data argument was omited
    if ( jQuery.isFunction( data ) ) {
        type = type || callback;
        callback = data;
        data = {};
    }

    return jQuery.ajax({
        type: "POST",
        url: url,
        data: data,
        success: callback,
        dataType: type
    });
},
Run Code Online (Sandbox Code Playgroud)

正如文档所说,它只是$ .ajax的简写