• 小程序全局ajax



    util = {
    request:function(appUrl,appData,called,type){
    wx.showLoading({
    title: '加载中...',
    })
    if(!type){
    type = "POST";
    }
    wx.request({
    url: appUrl,
    data:appData,
    header: {
    'content-type': 'application/json'
    },
    method: type,
    dataType: "json",
    success: callback, //成功回调
    fail: function (res) { },
    complete: function (res) {
    },
    })
    }
    }

    // 全局请求
    request: function (appUrl, appData, callback, type) {
    wx.showLoading({
    title: '加载中...',
    })
    if (!type) {
    type = "POST";
    }
    wx.request({
    url: appUrl,
    data: appData,
    header: {
    'content-type': 'application/x-www-form-urlencoded'
    },
    method: type,
    dataType: "json",
    success: callback, //成功回调
    fail: function (res) { },
    complete: function (res) {
    },
    })
    },
  • 相关阅读:
    2021/4/6
    2021/4/5
    2021/4/2
    2021/4/1
    2021/3/31
    2021/3/30
    2021/3/29重构
    总结
    js 座机正则
    uni-app 条件编译
  • 原文地址:https://www.cnblogs.com/weiwentaweb/p/8590174.html
Copyright © 2020-2023  润新知