https.js

This is a pure JavaScript small program, does not need third-party software support

View project on GitHub

Terminate these steps if header is a case-insensitive match for one of the following headers:

Learn more about header.

Learn more about header Content Type.

GET Example

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);

OPTIONS, PUT, POST, DELETE Example

var url = "https://example.com";
var db = "repositories=https&language=JavaScript";
var res_function = function(res, status) {
  if( status == 200){ //ok
  	var responseText = JSON.parse(res);
  	// responseText
  }
}
var ARGUMENTS = {URL:url, METHOD:'POST', DATA:db, RES_FUNCTION:res_function};
https(ARGUMENTS);

Author

weibo: yakeing

twitter: yakeing

License

MPL-2.0

license