import("storage"); functionget_main(){// handles the path "/" print(raw(""" <script> function getURL(x) { var req = new XMLHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4) { document.getElementById("target").innerHTML = "<a href='" + req.responseText + "'>" + req.responseText + "</a>"; } }; req.open("GET", "/revolve?url=" + x, true); req.send(null); } </script> """));
print(H1("AJAX Revolving Door"));
printp("Enter a URL starting with http://, and you will receive one back:"); print(raw(""" <input type="text" id="input" /> <input type="button" value="click" onClick="var i=document.getElementById('input');getURL(i.value);i.value='';" /> <div id="target"> </div> """)); }