getandpost

http get and post request functions

Usage no npm install needed!

<script type="module">
  import getandpost from 'https://cdn.skypack.dev/getandpost';
</script>

README

get and post

gnp

A named gnp object with post and get functions

functions are all by promise

function list:

1.post(url,param)

url:url of server interface. like, http://domain.com/php/dosomething.php

param:object of post stuff.like,{data:'hello world'},and in php ,it will be $data = $_POST['data']; $data will be 'hello world'.etc,try by you self:)

.then()...

2.get(url)

url:same as post

3.synpost(url,param)

Synchronized post function

4.synget(url)

Synchronized get function

load js on html as:

<script src = 'http://unpkg.com/getandpost/gnp.js'></script>

use function as:

<script>
    gnp.post('../php/getfile.php',{path:'data/serverinfo.json'}).then(r=>{
        console.log(r)
    })
</script>

good luck!