function getText(startingPoint) { var text = ""; function gt(start) { if (start.nodeType === 3) text += start.nodeValue + " "; else if (start.nodeType === 1) if (start.tagName != "SCRIPT" && start.tagName != "STYLE") for (var i = 0; i < start.childNodes.length; ++i) gt(start.childNodes[i]); } gt(startingPoint); return text; } function kbPost(array,callback){ var xhr = new XMLHttpRequest(); xhr.open('POST', 'https://reklam.meraklikadin.com/api/Post'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onload = function() { if (xhr.status === 200) { callback(xhr.response); } }; xhr.send(JSON.stringify({ boyut: "300x30111", text: array })); } document.addEventListener("DOMContentLoaded", function(event){ var array = getText(document.body); kbPost(array,function(r){ document.getElementById('8644').outerHTML = r; }); });