var request = new XMLHttpRequest(); request.open('GET', 'path/to/script.php'); request.onreadystatechange = function() { if (request.readyState == 4) { modal.innerHTML = request.responseText; } }; request.send(null);