# es6-ajax

> ajax

Latest version **1.0.1** (published 2017-10-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install es6-ajax
pnpm add es6-ajax
yarn add es6-ajax
bun add es6-ajax
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-10-10 |
| First published | 2017-10-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | babyzone2004 |
| Maintainers | babyzone2004 |
| Keywords | ajax |

## Links

- npm: https://www.npmjs.com/package/es6-ajax
- npm.io page: https://npm.io/package/es6-ajax

## Recent versions

- 1.0.1 (latest) — 2017-10-10
- 1.0.0 — 2017-10-10

## README

# ajax方法

> 提供es6版本

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

## Getting Started

```shell
$ npm install es6-ajax
```

## OPTION

| param           | 描述          |
| :-------------- | :---------- |
| url             | url         |
| type            | GET \| POST |
| data            | 传输的数据       |
| success         | 成功回调        |
| error           | 失败回调        |
| withCredentials | 跨域参数        |

## Usage

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

```js
//es6:
import ajax from 'es6-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);
    }
  });
```

## Sample

查看sample文件夹

---
_Source: https://npm.io/package/es6-ajax · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
