zoukankan      html  css  js  c++  java
  • jQuery系列---【jQuery中ajax封装】

    jQuery中ajax封装

    $.ajax({
                url: '', // 请求地址
                cache: '', // 是否缓存
                type: '', // 请求类型 get/post 默认get
                timeout: '', // 请求超时时间, 单位是毫秒
                data: '', // 请求的参数
                dataType: '', // 返回数据的格式 xml html text script json jsonp
                success: function (res) {}, // 成功的回调
                error: function (err) {}, // 失败的回调
                complete: function () {} // 完成的回调
            });

    //调用
      $.ajax({
                url: 'bendi.txt',
                type: 'get',
                success: function (res) {
                    console.log(res);
                }
            });

    注意:要先引入jQuery文件

  • 相关阅读:
    CGCDSSQ
    100200H
    斗地主
    借教室
    bzoj 3743
    17B
    能量项链
    589
    16-求连续数组和最大
    15-幸运数组4、7
  • 原文地址:https://www.cnblogs.com/chenhaiyun/p/14651692.html
Copyright © 2011-2022 走看看