Last active
December 18, 2015 14:39
-
-
Save suneo3476/5799160 to your computer and use it in GitHub Desktop.
【未解決】XMLHttpRequestのサンプル。いまいち成功しているかどうかが分からない。少なくともalertは出ないし…
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 HTML5> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<div>This is test for XMLHttpRequest.</div> | |
<script> | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', 'http://suneo3476.net'); | |
xhr.setRequestHeader('IF-Modified-Since', 'Thu, 01, Jun 1970 00:00:00 GMT'); | |
xhr.send(null); | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState == 4) { | |
if (xhr.status == 200) { | |
alert(xhr.responseText); | |
} | |
} | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment