Is it possible to change the value of a global variable in JavaScript?
If so, is it possible to do it in a function called by an event listener such as "onreadyStateChange"?
It's working for normal functions. but doesn't change when I call a function like this:
<script.......>
var dom1 = 3;
function work()
{
...
http.onreadyStateChange=handleHttpResponse;
...
}
function handleHttpResponse()
{
var xd;
if (http.readyState == 4)
{
if (http.status == 200)
{
if (http.responseText == "granted")
{
dom1 = 1;
}
else
{
dom1 = 2;
}
}
else
{
alert("Error");
}
}
}
</script>