本文主要包含ajax中datatype,ajax datatype,ajax datatype类型,jquery ajax datatype,ajax的datatype有哪些等相关知识,教程希望在学习及工作中可以帮助到您
");
</div>
- 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", 去掉后就没有问题了。
解决方法:
加上dataType:json后,
request header的accept为:application/json
假设你的response的content-type不是application/json,有可能就报错了