commit 7a497b1d4e150dbdbd9925248e985787948cc984 Author: Dita Aji Pratama Date: Tue Jun 10 10:28:59 2025 +0700 First Commit diff --git a/index.html b/index.html new file mode 100644 index 0000000..211e693 --- /dev/null +++ b/index.html @@ -0,0 +1,22 @@ + + + Widuri Client + + + + + + + + + + + + +
ID + Name + Phone +
+ + + diff --git a/js/carrack.js b/js/carrack.js new file mode 100644 index 0000000..db11e92 --- /dev/null +++ b/js/carrack.js @@ -0,0 +1,19 @@ +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); +}