MUi framework ajax request WebService interface instance_AJAX related

亚连
Release: 2018-05-21 16:22:11
Original
2636 people have browsed it

Below I will share with you an example of the MUi framework ajax request WebService interface, which has a good reference value and I hope it will be helpful to everyone.

The example is as follows:

mui.init(); mui.plusReady(function() { document.getElementById('login').addEventListener('tap',function() { var UserName=document.getElementById("account").value; var Userpassword= hex_md5(document .getElementById("password").value); mui.ajax('http://XXXXX/Login.asmx/MgLogin', { data:"{'loginname':'"+UserName+"','password':'"+Userpassword+"','identifies':'123456','code':''}", type:'POST',//HTTP请求类型 dataType:'json',//服务器返回json格式数据 timeout:10000,//超时时间设置为10秒; headers:{'Content-Type':'application/json'}, success:function(data) { //服务器返回响应,根据响应结果,分析是否登录成功; var jsons=data.d; var str=JSON.parse(jsons); if(str["StatusCode"]=="200") { mui.alert("登陆成功"); }else { mui.alert("登陆失败"); } }, error:function(xhr,type,errorThrown) { //异常处理; mui.alert(type); console.log(type); } }); }); });
Copy after login

Note: If there is a problem with the returned format It will prompt: abort

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Pull-up loading example written in native ajax (graphic tutorial)

ajax implementation of WeChat web page Authorized login method (graphic tutorial)

##Detailed explanation of using ajax to submit a form to the database (no refresh)

The above is the detailed content of MUi framework ajax request WebService interface instance_AJAX related. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!