Update xmlhttprequest.html to use an async request since sync requests are now deprecated.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1922 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
baa54fdadf
commit
8038ff9579
|
@ -4,10 +4,17 @@
|
|||
function execXMLHttpRequest()
|
||||
{
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET",document.getElementById("url").value,false);
|
||||
xhr.open("GET", document.getElementById("url").value, true);
|
||||
xhr.setRequestHeader('My-Custom-Header', 'Some Value');
|
||||
xhr.onload = function(e) {
|
||||
if (xhr.readyState === 4) {
|
||||
var value = "Status Code: "+xhr.status;
|
||||
if (xhr.status === 200)
|
||||
value += "\n\n"+xhr.responseText;
|
||||
document.getElementById('ta').value = value;
|
||||
}
|
||||
}
|
||||
xhr.send();
|
||||
document.getElementById('ta').value = "Status Code: "+xhr.status+"\n\n"+xhr.responseText;
|
||||
}
|
||||
</script>
|
||||
<form>
|
||||
|
|
Loading…
Reference in New Issue