ocarina/html/utils.js

39 lines
817 B
JavaScript
Raw Normal View History

// Bryan Schumaker (12 / 27 / 2010)
function set_attr(attr, id)
{
var req = new XMLHttpRequest();
req.onreadystatechange = function()
{
if (req.readyState == 4 && req.status == 200)
{
document.getElementById(id).innerHTML = req.responseText;
}
}
req.open('GET', "controls.py?a=" + attr, true);
req.send();
setTimeout("set_attr(\"" + attr + "\", \"" + id + "\")", 3000)
}
function set_attr_once(attr, id)
{
var req = new XMLHttpRequest();
req.onreadystatechange = function()
{
if (req.readyState == 4 && req.status == 200)
{
document.getElementById(id).innerHTML = req.responseText;
}
}
req.open('GET', "controls.py?a=" + attr, true);
req.send();
}
2010-12-27 13:01:48 -05:00
function send_request(action)
{
var http = new XMLHttpRequest();
http.open('GET', "controls.py?a=" + action, true);
http.send();
}