redishketch-romeo

0.3.1 • Public • Published

Redishketch-romeo (HTTP Request module)

Simple and user-friendly HTTP Request Module(plugin). Based on pure Javascript. fast and customisable,

Vue.js

Redishketch-romeo was created to use in vue.js 2.0

View Demo

View Redishketch-romeo demo.

Getting started

Installation

Quick Start with GIT with Documentation

git clone https://github.com/shudhuiami/redishketch-romeo.git

Quick Start with NPM

  • Install with NPM npm install redishketch-romeo

Usage

POST method

function submitform(event) {
        event.preventDefault();
        var el = event.currentTarget;
        new resources({
            url: "http://localhost/redishketch-romeo/testServer/post.php",
            method: "POST",
            el: el,
            data: {
                user: "amieami",
                pass: "12345"
            },
            onSuccess: function (response) {
                console.log(response);
                document.getElementById('simple_element').innerHTML = response;
            }
        });
    }

Assigning Data:

There are two ways to assign a in a Post Request.

** Assign A Form: Select the Form and assign that to el.

    function submitform(event) {
            event.preventDefault();
            var el = event.currentTarget;
            new resources({
                url: "http://localhost/redishketch-romeo/testServer/post.php",
                method: "POST",
                el: el,
                onSuccess: function (response) {
                    console.log(response);
                    document.getElementById('simple_element').innerHTML = response;
                }
            });
        }

#####Append data in a form:

Just use data with el.. and you are ready to append data with a form

function submitform(event) {
     event.preventDefault();
     var el = event.currentTarget;
     new resources({
         url: "http://localhost/redishketch-romeo/testServer/post.php",
         method: "POST",
         el: el,
         data: {
             user: "amieami",
             pass: "12345"
         },
         onSuccess: function (response) {
             console.log(response);
             document.getElementById('simple_element').innerHTML = response;
         }
     });
 }         

#####Use Array or Object statically:

Use data

function submitform(event) {
     event.preventDefault();
     new resources({
         url: "http://localhost/redishketch-romeo/testServer/post.php",
         method: "POST",
         data: {
             user: "amieami",
             pass: "12345"
         },
         onSuccess: function (response) {
             console.log(response);
             document.getElementById('simple_element').innerHTML = response;
         }
     });
 }

GET method

function submitform(event) {
       new resources({
                   url: "http://localhost/redishketch-romeo/testServer/get.php",
                   method: "GET",
                   onSuccess: function (response) {
                       console.log(response);
                       document.getElementById('getresult_fild').innerHTML = response;
                   }
       });
    }

Vue.js Usage

Import in Project

import 'redishketch-romeo'

than call under any function ##Example

GET METHOD

created(){
new resources({
    url: "API/URL goes here",
    method: "GET",
    onSuccess: function (response) {
               console.log(response);
       }
    });
}

POST METHOD

created(){
var el = 'form/input';
new resources({
    url: "API/URL goes here",
    method: "POST",
    el: el,
    data: {
       user: "amieami",
       pass: "12345"
    },
    onSuccess: function (response) {
    console.log(response);
    }
}

Package Sidebar

Install

npm i redishketch-romeo

Weekly Downloads

0

Version

0.3.1

License

ISC

Unpacked Size

52.4 kB

Total Files

10

Last publish

Collaborators

  • shudhuiami