mui-json的例子

mui.ajax(path,{

       //传入的参数

       data: {
               token:token,
               gnbh:gnbh
       },
       dataType:'json',//服务器返回json格式数据
       type:'post',//HTTP请求类型
       timeout:30000,//超时时间设置为30秒;

       success:function(data){

//code是根据后台返回来的数据决定的

           if(data.code=='success'){
             
              }
           }else{
                   mui.toast(data.message);
           }
        },
        error:function(xhr,type,errorThrown){
           //异常处理;
           mui.toast('服务器异常登录失败!');
        }
        });

posted @ 2017-11-28 10:14  alice-you  阅读(1618)  评论(0编辑  收藏  举报