Last active
August 29, 2015 14:27
-
-
Save codeniko/8ab3030d2f4b7c1ae7b3 to your computer and use it in GitHub Desktop.
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script> | |
<script> | |
function getContent() { | |
http.get('content.php', function (res) { | |
var resChunks = ''; | |
res.on('data', function (data) { | |
resChunks += data; | |
}) | |
res.on('end', function () { | |
var resBody = resChunks || '<h3>No response, this is default</h3>'; | |
document.getElementById("contentbox").innerHTML=resBody; | |
}); | |
res.on('error', function (e) { | |
document.getElementById("contentbox").innerHTML='ERROR'; | |
}); | |
}); | |
} | |
</script> | |
</head> | |
<body> | |
<div id="contentbox"></div> | |
<button onclick="getContent()">Get Content</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment