1

I tried to retrieve the blogger feeds code without using <script src = I tried document.write but when import is done the original page content is deleted Is there a way to import when pressing a button without using <script

<button onclick="myFunction()">Click me</button>
<h1>Test Content</h1>

<script>
function myFunction() {
// The problem here is deleting the text content With document
// And I tried Use document.createElement
// Is there any other way to call and run the file codes ?

 document.open();
document.write('<script type="text/javascript" src="https://photoshop4all.com/feeds/posts/default?max-results=5&alt=json-in-script&callback=URLAGAIN"><\/script>');

document.close();



  }



  function URLAGAIN(json) {


  document.write(json.feed.entry[0].link[1].href);




    }
</script>
Spy Share
  • 17
  • 1
  • 6

1 Answers1

0

see : https://www.w3schools.com/JSREF/met_doc_open.asp

The open() method opens an output stream to collect the output from any document.write() or document.writeln() methods.

Once all the writes are performed, the document.close() method causes any output written to the output stream to be displayed.

Note: If a document already exists in the target, it will be cleared.

Note: Do not confuse this method with the window.open() method, which opens a new browser window.

you can see here how to insert script whith js