Skip to content

mekto/request.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Request.js

Request.js is a small library for asynchronous http requests.

This library uses methods from ECMAScript 5, so to use it with older browsers (IE7, IE8) use ES5-Shim or Augment.js.

To support JSON in older browsers use JSON-js.

Example

var request = Request();

request.send({
  url: '/some-url',
  method: 'post',
  data: {exampleParam: 10},
  success: function(rv) {
    console.log(rv.text);
  }
});

You can set options at object creation as follows:

var xhr = Request({
  url: '/add-page',
  method: 'post',
  success: function(rv) {
    alert('Page added');
  }
});

xhr.send({data: {title: 'About Us', content: 'This is short info about us.'}});
xhr.send({data: {title: 'Contact', content: 'Use the form below to contact...'}});

About

JavaScript micro library for Ajax requests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published