Compare commits
No commits in common. "d923798622c273f15edce7465302400d834c416a" and "db036aff771cc1edf37ac5501bd59ffa0095eef7" have entirely different histories.
d923798622
...
db036aff77
@ -1,19 +0,0 @@
|
||||
function sendHttpRequest(url, method, data, callback, contentType = "multipart/form-data", authorization = "") {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open(method, url, true);
|
||||
xhr.setRequestHeader("Content-Type", contentType);
|
||||
xhr.setRequestHeader("Authorization", authorization);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200) {
|
||||
var response = xhr.responseText;
|
||||
callback(null, response);
|
||||
}
|
||||
else callback(xhr.status, null);
|
||||
}
|
||||
};
|
||||
var requestData;
|
||||
if (contentType === "application/json") requestData = JSON.stringify(data);
|
||||
else requestData = data;
|
||||
xhr.send(requestData);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user