jquery ajax 设置请求头header 参数

在beforeSend或在headers加参数都可以,参数值中不能包含中文。
$.ajax(
                {
                    url:'http://127.0.0.1:30080/api-a/quasiCustom/selectCustomList',
                    type:'post',
                    dateType:'json',
                    beforeSend: function(xhr) {
xhr.setRequestHeader('token', '876d06e5647ec41d388b8fbe73966');

},
headers:{'Content-Type':'application/json;charset=utf8','organId':'1333333333'},
data:JSON.stringify(org),
                    success:function(data){console.log("sucess");},
                    error:function(data){console.log("error");}
                }
            );




posted @ 2022-08-25 11:15  net5x  阅读(5135)  评论(0编辑  收藏  举报