Last active
December 17, 2015 05:18
-
-
Save delba/5556813 to your computer and use it in GitHub Desktop.
Replacing current page with ajax response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xhr = new XMLHttpRequest | |
| xhr.onreadystatechange = (e) -> | |
| if @readyState is 4 and @status is 200 | |
| document.body.innerHTML = @responseXML.body.innerHTML | |
| xhr.open 'GET', '/page' | |
| xhr.responseType = 'document' | |
| xhr.send() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment