I am trying to create line like this one
<script src="https://www.xtradown.com/feeds/posts/default?alt=json-in-script&max-results=200&start-index=5&callback=peter"></script>
using that code
var s = document.createElement("script");
s.type = "text/javascript";
s.src = "https://www.xtradown.com/feeds/posts/default?alt=json-in-script&max-results=200&start-index=5&callback=peter";
$("body").append(s);
to be able to change it's content like
start-index=5
to any value I want at any time.
the rest of the code is :
<script>
function peter(e){
for(i = 0 ; i < e.feed.entry.length ; i++){
document.write(e.feed.entry[i].title.$t + "<br/>");
}
}
</script>
unfortunately, when I executed that code I got this message
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
please help me understanding what is the problem.
the rest of the code is. Does that mean that is the code found at the xtradown.com url? Or does that mean you're executing that script sometime later in your webpage?