Reading the documentation for document.write()
we find this:
Writes a string of text to a document stream opened by
document.open()
. […]
Writing to a document that has already loaded
without callingdocument.open()
will automatically perform a
document.open
call
… and the documentation for document.open()
says:
The document.open() method opens a document for writing. […]
If a
document exists in the target, this method clears it
Using document.write()
to inject raw HTML is possibly the most annoying tool to create dynamic documents. You are using jQuery—make use of its DOM manipulation tools.
solved How to remove jquery json popup? [closed]