n***@126.com
n***@126.com
  • 发布:2018-09-20 10:38
  • 更新:2019-09-06 17:57
  • 阅读:3455

mui.ajax() get请求

分类:MUI

接口是get请求,就一个参数,是直接拼在地址后面的
请求地址:http://xxxx.com/machine-web-service/code/dropDown/list/MachineState
MachineState是参数,这种情况,我用mui.ajax(),请求不到,报400错误,看请求地址
是http://xxxx.com/machine-web-service/code/dropDown/list/MachineState?{}
后面多加了?{},这种情况怎么解决
我的代码是
mui.ajax(apiList.codeDropDownList + type, {
data: {},
dataType: 'JSON', //服务器返回json格式数据
type: 'get', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
headers: {
'Content-Type': 'application/json',
token: JSON.parse(localStorage.getItem("userdata")).token
},
success: function(data) {
data = JSON.parse(data)
if(data.success) {
showpicker(type, data)
} else {
mui.toast(data.msg);
}
},
error: function(xhr, type, errorThrown) {
mui.toast("获取失败,请稍后再试!");
}
});

2018-09-20 10:38 负责人:无 分享
已邀请:
DCloud_UNI_CHB

DCloud_UNI_CHB

输出一下 apiList.codeDropDownList + type 这两个值,可能是这里拼错了

  • n***@126.com (作者)

    /machine-web-service/code/dropDown/list/MachineState


    2018-09-20 15:34

  • n***@126.com (作者)

    这两个拼出来就是这个


    2018-09-20 15:34

1***@qq.com

1***@qq.com

请问解决了吗 怎么解决的

该问题目前已经被锁定, 无法添加新回复