Last active
May 24, 2017 18:10
-
-
Save zalazhar/e58bc0aefc9ce15fa9cbbbb9f78b0aa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function form (json){ | |
return Object.keys(json).map(key=>encodeURIComponent(key)+'='+encodeURIComponent(json[key])).join('&'); | |
}; | |
function createRobject(Rlib, Rfunc, Rparams) { | |
return fetch(Rlib + Rfunc, { | |
method: 'post', | |
headers: { | |
'Accept': 'application/json, text/plain, */*', | |
'Content-Type': 'application/x-www-form-urlencoded' | |
}, | |
body: form((Rparams)) | |
}) | |
}; | |
function loadRobject(Location , type) { | |
return fetch(Location).then (function (response){ return response.text()}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment