You shoud use something other than document.write
, like getting the actual element you're trying to add content to, and the insert the HTML into that :
document.getElementById('modal-content').innerHTML = 'stuff to add here';
jQuery version:
$('#modal-content').html('stuff to add here');