415错误,400错误

一、415错误

将ajax的contentType属性设置为"application/json;charset=UTF-8",如下所示:

$.ajax({
            url: securedroot + "linkage/log/deleteTodaySchedule",
            type: "POST",
            dataType: "json",
            contentType: "application/json;charset=UTF-8",
            data: JSON.stringify(object),
            success: function () {
                
            },
            error: function () {
                
            }
        });

二、400错误

前后台的数据是以字符串的形式传输的,将json格式的js对象转成json格式的字符串传输,如下所示:

$.ajax({
            url: securedroot + "linkage/log/deleteTodaySchedule",
            type: "POST",
            dataType: "json",
            contentType: "application/json;charset=UTF-8",
            data: JSON.stringify(object),
            success: function () {
                
            },
            error: function () {
                
            }
        });

 

posted @ 2018-12-08 16:34  anderson_1996  阅读(8793)  评论(0编辑  收藏  举报