var serviceUrl = document.currentScript.getAttribute('serviceurl'); var siteId = document.currentScript.getAttribute('siteid'); var postId = document.currentScript.getAttribute('postid'); var remark42Host = document.currentScript.getAttribute('remark42host'); function ajax(url, type, payload) { if (payload === undefined) { payload = null; } return new Promise(function (resolve, reject) { var xhr = new XMLHttpRequest(); xhr.onload = function () { resolve(this.responseText); }; xhr.onerror = reject; xhr.open(type, url); xhr.send(payload); }); }