1.0.2 • Published 7 years ago

b_ajax v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

ajax方法

提供es6,amd,commonjs,umd版本

适配移动端,轻便简单的ajax

Getting Started

$ npm install b_ajax

OPTION

param描述
urlurl
typeGET | POST
data传输的数据
success成功回调
error失败回调
withCredentials跨域参数

Usage

跟jquery用法差不多,只接受json数据所以不需要设置dataType

//es6:
import * as tap from 'b_ajax';
ajax({
    url: './test.json',
    type: 'GET',
    data: {
      a: 1,
      b: 2
    },
    success: function (msg) {
      console.log('success', msg);
      id('result').innerHTML = JSON.stringify(msg);
    },
    error: function(xhr) {
      console.log('error', xhr);
    }
  });

//commonjs
var tap = require('bTap/dist/ajax-commonjs.js');

//amd umd
...

Sample

http://babyzone2004.github.io/modules/ajax/sample/index.html

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago