This is a pure JavaScript small program, does not need third-party software support
- Pure JavaScript writing
- A simple class file
Use Node.js to install the library. Of course, You can go to package to view.
npm i https.js
var url = "https://example.com";
var res_function = function(res, status) {
if( status == 200){ //ok
var responseText = JSON.parse(res);
// responseText
}
}
var ARGUMENTS = {URL:url, RES_FUNCTION:res_function, HEADER:{'Content-type':'application/json;charset=UTF-8'}};
https(ARGUMENTS);
If you need to learn more, go to more examples.
weibo: yakeing
twitter: yakeing