php ajax parsererror,mui.ajax报错 error:parsererror
登陆验证mui.ajax 一直报错 error:parsererror
后台返回是json格式没错啊,但app前端一直报错 parsererror
登陆js:
mui.ajax(owner.baseUrl+'login/',{
data:{
username: loginInfo.account,
password: loginInfo.password,
clientid: clientid
},
dataType:'json',//服务器返回json格式数据
type:'post',//HTTP请求类型
timeout:10000,//超时时间设置为10秒;
headers:{'Content-Type':'application/json'},
success:function(data){
//服务器返回响应,根据响应结果,分析是否登录成功;
if(data.status==true){
owner.createState(loginInfo.account, callback, data.access_token, data.user_id);
}
if(data.status==false)
{
return callback(data.msg);
}
},
error:function(xhr,type,errorThrown){
//异常处理;
console.log('error:'+type);
callback('服务器繁忙,请稍后再试。')
}
});
后端login.php:
//header("Content-Type:text/html; charset=utf-8");
header('Content-type:application/json');//输出为json格式页
header("Access-Control-Allow-Origin: *"); // 允许任意域名发起的跨域请求
header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With');
class LoginController extends AppBaseController
{
public function index()
{
return json(['status'=>true,'msg'=>'请输入用户名或密码!']);
}
}
php ajax parsererror,mui.ajax报错 error:parsererror相关推荐
- php ajax parsererror,ajax中的 textStatus 报错为 parsererror。
问题描述: ajax中的 textStatus 报错为 parsererror.html> $.ajax({ type: "GET", url: "http://1 ...
- Ajax传JSON对象报错:JSON parse error: Unrecognized token ‘ids‘: was expecting (‘true‘, ‘false‘ or ‘null‘);
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unrecognized t ...
- $.ajax 加了headers报错_Springboot解决Ajax跨域的三种方式
这篇文章不华丽,但比较实用,能解决不少大家实际业务中的问题.大家可以收藏起来,以备用时之需! 1.同源策略 1.1 含义 ajax出现请求跨域错误问题,主要原因就是因为浏览器的"同源策略&q ...
- ajax上传文件报错The current request is not a multipart request的解决办法
ajax上传文件报错The current request is not a multipart request的解决办法 主要报错语句为: The current request is not a ...
- Flex报错Error #2048: 安全沙箱冲突
Flex+JPA架构,JPA程序迁移,从A服务器到B.其他一切没变,唯一变的就是IP. 前端Flex也就是swf报错Error #2048: 安全沙箱冲突:http://xxx.swf 不能从 xxx ...
- git:Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists)....
Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists). 解决办法一:保 ...
- SAP MM MB21创建预留单据报错- Error during conversion to alternative units of measure -
SAP MM MB21创建预留单据报错- Error during conversion to alternative units of measure - 某日下午收到业务部门报错,说是创建预留单保 ...
- QQ第三方登录报错error=-1
qq 第三方登录报错error=-1 再次实例化qc类.
- mysql source导入报错ERROR 1366的解决方法
mysql source导入报错ERROR 1366的解决方法 参考文章: (1)mysql source导入报错ERROR 1366的解决方法 (2)https://www.cnblogs.com/ ...
最新文章
- 小团队如何玩转物联网开发?
- 进程通信学习笔记(管道)
- 给Source Insight做个外挂系列之五--Insight “TabSiPlus”
- reactjs快速如梦_帮助您理解和创建ReactJS应用的快速指南
- (二叉树的遍历)Tree UVa 548
- flutter usb串口_Flutter 调试方式
- 《验收测试驱动开发:ATDD实例详解》—第2章2.2节结对完成第一个测试
- CherryPy上传文件
- 动物统计 nyoj286
- python写连点脚本_python鼠标连点器-测试版
- 怎么裁剪PDF文件页面?一种方法轻松搞定
- 学习感悟(人脸识别)
- 生产制造追溯系统-再说条码打印
- 经典 正则表达技术文档
- 计算机网络涉及的数学知识点,计算机考研:计算机网络六大重要知识点
- 吉天工业数据自动采集系统(DCS)实现工业4.0的智慧工厂
- 科研论文投稿状态解析大全
- 火车运输java_基于jsp的火车售票-JavaEE实现火车售票 - java项目源码
- 人造地球卫星轨道外推Matlab,一种适用于圆轨道卫星的星上自主轨道外推方法
- insert into... where not exists插入避免重复的使用
热门文章
- 优雅编程之这样处理边界,你就“正常”了!
- udf函数(udf udaf udtf)
- 龙之谷2服务器维护,《龙之谷2》【已开服】1月29日抢先区停服更新公告
- Unity热更新系列之 大版本更新应用覆盖安装问题
- 操作简单的pdf转word转换器
- WPF 控件专题 WrapPanel 控件详解
- webassembly_全球最简单的WebAssembly简介?
- windows在命令行配置IP地址
- [ 利器篇 ] - LInux 下百度网盘客户端 BaiduPCS
- C# SqlTransaction的使用