zoukankan      html  css  js  c++  java
  • spring 415

    不支持的媒体类型

    spring mvc 使用@requestBody注解json请求时,jQuery有限制,否则会出现 415 错误

    1、使用ajax 
    $.ajax({
                    data: JSON.stringify(Abstract.searchCondition),
                    url: url,
                    async: true,
                    type: 'post',
                    contentType: 'application/json',
                    success: function (response) {
                        
                    },
                    complete:function(){               
                    },
                    error: function (XMLHttpRequest, timeout, errorThrown) {
                    }
                });  
    2、使用post
    $.ajaxSetup({
    headers: {'Content-type': 'application/json;charset=UTF-8'}
    });
         $.post('/applications/overview/getTransactionsChartData',
            JSON.stringify(data), function (response) {
    }
    }, 'JSON');
    };




  • 相关阅读:
    Mono 1.1.16
    Minimum Profit 3.3.18a
    PenguinTV 1.90
    Beagle 0.2.7
    Bonfire 0.4.0
    wxDownload Fast 0.4.5
    Network Configurator 0.1.8
    VMware Server 1.0
    MonoDevelop 0.11
    GTKsopcast 0.2.8
  • 原文地址:https://www.cnblogs.com/vvch/p/4871734.html
Copyright © 2011-2022 走看看