ajax-for-node

1.0.12 • Public • Published

A-Design Logo

🚀 nodeajax

Implementing Ajax request of jQuery with node without cross-domain.

Install

$ npm install ajax-for-node

Usage

const nodeAjax = require('ajax-for-node');

var formData = new FormData();
formData.append("username", "Groucho");
formData.append("accountnum", 123456);

nodeAjax({
    url: "https://echo.apipost.cn/get.php",
    data: formData,
    type: "POST",
    processData: false,
    contentType: false,
    success: function (data, status, xhr) {
        console.log(data, status, xhr)
    },
    error: function (xhr, status, error) {
        console.log(xhr, status, error)
    },
    complete: function (xhr, status) {
        console.log(xhr, status)
    }
});

/ajax-for-node/

    Package Sidebar

    Install

    npm i ajax-for-node

    Weekly Downloads

    9

    Version

    1.0.12

    License

    MIT

    Unpacked Size

    5.1 kB

    Total Files

    5

    Last publish

    Collaborators

    • chengyang12138
    • proud_lion
    • lee-meng
    • wjzhangq
    • apipost-lab001
    • xbw19975