久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

node.js - axios 請求數(shù)據(jù),返回?cái)?shù)據(jù) data為空怎么辦

瀏覽:139日期:2024-07-19 10:38:38

問題描述

axios 請求數(shù)據(jù),返回?cái)?shù)據(jù) data為空

同樣的借口用jq的ajax調(diào)用就是好的

$.ajax({ url: ’/yzh/inter/login’, type: ’post’, data: {’userName’: username, ’passWord’: password}, success: function (res) {console.log(res); }});

node.js - axios 請求數(shù)據(jù),返回?cái)?shù)據(jù) data為空怎么辦

下邊是axios的發(fā)送

var config = { headers: { ’Content-Type’: ’application/x-www-form-urlencoded’ }, responseType: ’json’,// default method: ’post’};axios.post(’/yzh/inter/login’, { userName: this.ruleForm.username, passWord: this.ruleForm.password },config).then((res) => { //if (res) { //state.username = res.data.data console.log('haha',res) // }})

返回結(jié)果中 data為null

node.js - axios 請求數(shù)據(jù),返回?cái)?shù)據(jù) data為空怎么辦

請問這個問題怎么解決啊。。

問題解答

回答1:

估計(jì)哪里寫法不對

回答2:

嘗試在server端分析,把接收到的參數(shù)打印出來看看是否一致

回答3:

可能是axios的post參數(shù)問題。參考axios POST

回答4:

https://www.npmjs.com/package...post請求默認(rèn)是發(fā)送json格式的數(shù)據(jù)

主站蜘蛛池模板: 乌苏市| 昌图县| 潜江市| 诸暨市| 河西区| 长治县| 濉溪县| 阜阳市| 佛冈县| 尤溪县| 宁化县| 布尔津县| 芦山县| 四会市| 榆社县| 双桥区| 娱乐| 荆州市| 苗栗市| 江安县| 定襄县| 兴和县| 广河县| 平陆县| 资溪县| 河池市| 天门市| 鄂伦春自治旗| 新蔡县| 庄浪县| 富阳市| 樟树市| 花垣县| 苍山县| 崇仁县| 旅游| 治县。| 江城| 曲松县| 赤城县| 伊吾县|