Code Monkey home page Code Monkey logo

req-ajax's Introduction

req-ajax

npm npm

Standalone library for ajax requests.

Installation

Execute this command in your project for install the package:

npm install req-ajax --save

Usage

Simple external script in your html file:

<script src="node_modules/req-ajax/dist/ajax.min.js"></script>

Also this can be used with webpack just require the module req-ajax.

API documentation

Ajax constructor

new Ajax(config)

the config object:

Properties

  • url - {String} is required.
  • method - {String} is required.
  • params - {Object} is optional, this property is for specific queries. The queries like this foo=bar&bar=foo can be transformed to { foo: 'bar', bar: 'foo' } in the JavaScript object notation, so is much better for make queries and easy.
  • fragment - {String} is optional, without the # character.

Methods

  • success(response) - {Function} is optional.
  • error(status, headers) - {Funcion} is optional.

Test

For the unit-test install the devDependencies and open the file test/index.html in your browser.

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.