请选择 进入手机版 | 继续访问电脑版
 找回密码
 立即注册
搜索

请问:如何跨域请求后端接口和header值

6
回复
2307
查看
[复制链接]

1

主题

2

帖子

0

积分

 楼主| 2018-4-11 16:35:19 显示全部楼层 |阅读模式
请问: 1、如何跨域请求后端接口 2、header如何传json,用{'Content-Type': 'application/json'}方法报错 handling fail, code=200 handling fail, data=The value of 'content-type' isn't supported when post json object onInit () { fetch.fetch({ url:"http://192.168.1.90:9840/smart/menu/getMenuData", data:{"publicnumid":"293828096774123520","type":1}, method:"POST", header:{'Content-Type': 'application/json'}, success:function(data){ console.log("title: " + JSON.parse(data.data)); }, fail: function(data, code) { console.log("handling fail, code=" + code); console.log("handling fail, data=" + data); } }) }
回复

使用道具 举报

8

主题

226

帖子

700

积分

2018-4-12 11:17:10 显示全部楼层
跨域??
回复

使用道具 举报

1

主题

2

帖子

0

积分

 楼主| 2018-4-12 13:03:14 显示全部楼层
跨域已经解决了
回复

使用道具 举报

0

主题

3

帖子

10

积分

2018-5-16 20:40:48 显示全部楼层
post请求能成功? The value of 'content-type' isn't supported when post json object 请问这个问题怎么解决的?
回复

使用道具 举报

9

主题

25

帖子

170

积分

2018-11-22 17:29:56 显示全部楼层
Dovar 发表于 2018-5-16 20:40 post请求能成功? The value of 'content-type' isn't supported when post json object 请问这个问题怎么 ...
需要把数据转换成json字符串才可以。 我试了一小时才发现的,亲娘哟。。。
回复

使用道具 举报

15

主题

42

帖子

285

积分

2019-5-15 16:39:41 显示全部楼层
Rain 发表于 2018-4-12 13:03 跨域已经解决了
你是怎么解决的呢?我刚好也遇到这个问题
回复

使用道具 举报

0

主题

3

帖子

15

积分

2019-8-28 21:26:09 显示全部楼层
本帖最后由 桑叶dh 于 2019-8-28 21:27 编辑
kinsson 发表于 2019-5-15 16:39 你是怎么解决的呢?我刚好也遇到这个问题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册