Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ajax-promise

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ajax-promise

Ajax with Promises

  • 0.0.1
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

AjaxPromise

Requirements

We don't include the requirements in the package because we assume it is part of your package.json file already.

  • jquery: jQuery used for the AJAX calls
  • bluebird: bluebird used for the promises

Description

A very narrowly scoped Ajax library that returns promises instead of using callbacks.

Return values should be JSON objects with status 200.

If status not 200, then the promise will return an error. The error should be returned as a JSON object as well.

Usage

var AjaxPromise = require('ajax-promise');

AjaxPromise
  .get('/pages')
  .then(function (response) {
    console.log(response);
  })

AjaxPromise
  .post('/pages', {title: 'Hello', body: 'Hello to the world!'})
  .then(function (response) {
    console.log(response);
  })
  .catch(function (err) {
    console.log('errors in response', err);
  })

Keywords

FAQs

Package last updated on 20 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc