There's quite nothing that makes me as frustrated as web development, which luckily I don't get to do often, and here's an example why. Is there any reason why the following code works perfectly fine in DreamWeaver Live View, stops after alert("2") (alert 3 never appears, neither does anything in output) on Chrome and doesn't work at all in Internet Explorer?
<script type="text/javascript">
function getStuff() {
var url = "http://url/to/restful/api";
alert("1");
var client = new XMLHttpRequest();
client.open("GET", url, false);
client.setRequestHeader("Content-Type", "application/json");
alert("2")
client.send();
alert("3")
document.getElementById("output").value = client.responseText;
}
</script>
This is called like this:
<button onClick="getStuff()">GET</button>