zoukankan      html  css  js  c++  java
  • MUI之ajax获取后台接口数据

      mui.plusReady(function() {
              getToDoNum();
     });    
      function getToDoNum(){   
          mui.ajax("接口地址", { 
              data: {
                      task_tenantId:"f0fd6e1f-cf85-11e7-98b1-fa163e00a2e7",
                      task_formKey:"pid-88fa484b-2d67-4e6e-8967-b9521cc5ef52"
                  },
             dataType: 'json',
             contentType: 'application/json;charset=utf-8', //服务器返回json格式数据
             type: 'POST', //HTTP请求类型
             timeout: 10000, //超时时间设置为10秒;
             headers:{"Authorization":"Basic YWRtaW46YWRtaW4="},    //接口权限,用户名和密码    
             success: function(result,status,xhr) {
                 console.log(result)
                 document.getElementById("toDoNum").innerHTML=result.count; 
             },    
             error: function(xhr,status,err) {    
                 mui.each(xhr,function(i){   
                     console.log(xhr[i])  
                })
                 console.log(err)
                 plus.nativeUI.closeWaiting();
             }
         });
     }
    

      

    DO What You Want !
  • 相关阅读:
    前端js(一)
    前端CSS
    前端HTML
    视图等
    Navicat使用
    查询语句
    SpringBoot不能直接访问templates下的静态资源
    Mybatis什么时候用${}
    thymeleaf使用restul风格URL
    SpringBoot使用PageHelper
  • 原文地址:https://www.cnblogs.com/liumengdie/p/7903243.html
Copyright © 2011-2022 走看看