First, jQuery is JavaScript, it is just a library of functions to make coding easier.
Second, you should avoid the use of document.write. You should use jQuery to append the text to the DOM element you want.
Example:
$('#myDiv').append('some new text')