wangda_cn
wangda_cn
  • 发布:2015-07-21 00:25
  • 更新:2015-08-05 18:26
  • 阅读:2539

【报Bug】mui.ajax 增加 dataType="json"后,报406错误

分类:MUI

环境:锤子T1 4G版

代码:

复制代码            mui.ajax(url, {  
                data: regInfo,  
//              dataType: "json",  
                type:"POST",  
                timeout: 20000,  
                success: function(data) {  
                    console.log(data);  
                },  
                error: function(xhr, type, errorThrown) {  
                    console.log(xhr.responseText);  
                    alert(xhr.responseText);  
                }  
            });

输出:
HTTP Status 406 he resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.

dataType: "json", 去掉后就没有问题了。

2015-07-21 00:25 负责人:无 分享
已邀请:
天之畔

天之畔

同问,我也遇到了这个问题

DCloud_UNI_FXY

DCloud_UNI_FXY

有服务端的地址吗?给一个可以测试的url地址,我测试下

加上dataType:json后,
request header的accept为:application/json
假设你的response的content-type不是application/json,有可能就报错了

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

  • 标题 / 粗斜体
  • 代码片段
  • 超链接 / 图片 / 视频
  • 列表 / 引用

文章内容较多时,可以用标题分段 :

## 大标题 
### 小标题

斜体 / 粗体 :

**粗体** 
*斜体*
***粗斜体***

代码片段 :

``` javascript
代码片段
```

超链接 :

[链接文字](链接地址) 例: [百度](http://www.baidu.com)

图片 :

![图片说明](图片地址) 例: ![百度logo](http://www.baidu.com/img/bdlogo.gif)

视频 :

!![视频说明](视频地址) 例: !![优酷视频](http://youku.com)

有序列表 :

1. 123
2. 123
3. 123

无序列表 :

- 123
- 123
- 123

引用 : ( 双回车后结束引用 )

> 引用内容
引用内容
引用内容