<p id="link"></p> <script src="https://raw.githack.com/ptcreborn/ptcreborn/main/sample1.js" type="text/javascript"></script> <script> // https://getpantry.cloud/apiv1/pantry/8c1037f6-bf4b-443d-9941-a9f9c6a99671/basket/accounts let data = JSON.stringify({ "name": "lems" }); function setCookie(e, t, l) { var o = new Date; o = new Date(o.getTime() + 1e3 * l), document.cookie = e + "=" + t + "; expires=" + o.toGMTString() + ";"; } function getCookieName(e) { var t = document.cookie, l = e + "=", o = t.indexOf("; " + l); if (-1 == o) { if (0 != (o = t.indexOf(l))) return null } else { o += 2; var n = document.cookie.indexOf(";", o); - 1 == n && (n = t.length) } return decodeURI(t.substring(o + l.length, n)) } function getID(str) { document.querySelector('#link').innerText = str.split('location: ')[1]; console.log(str.split('location: ')[1]); } function getRecord(callback) { let req = new XMLHttpRequest(); req.onload = () => { if (req.readyState == 4) if (req.status == 200) if(callback) callback(req.response); } req.onerror = (err) => { window.alert('Error encountered! ' + err); } req.open('GET', 'https://jsonblob.com/api/jsonBlob/1230120638059765760', true); req.setRequestHeader('Content-Type', 'application/json'); console.log('sending...'); req.send(); } function createRecordBlob(data, callback) { console.log('entered'); let xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.open('POST', 'https://jsonblob.com/api/jsonBlob', false); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('Accept', 'application/json'); xhr.onload = function () { callback(xhr.getAllResponseHeaders()); }; xhr.send(data); } function createRecord(data, callback) { let req = new XMLHttpRequest(); req.onload = () => { if (req.readyState == 4) if (req.status == 200) if(callback) callback(req.response); } req.onerror = (err) => { window.alert('Error encountered! ' + err); } req.open('POST', 'https://getpantry.cloud/apiv1/pantry/8c1037f6-bf4b-443d-9941-a9f9c6a99671/basket/posts', false); req.setRequestHeader('Content-Type', 'application/json'); req.send(JSON.stringify(data)); } createRecordBlob(data, function(str) { document.querySelector('#link').innerText = str.split('location: ')[1]; console.log(str.split('location: ')[1]); }); </script>