rendered paste body<html> <head> <title>Øving 14 - AJAX / Job Manager</title> <script type="text/javascript"> var base_url = "http://localhost:8080/tod075/oving3/"; function HTTPObjekt() { if (typeof window.XMLHttpRequest == "function") { return new XMLHttpRequest(); } if (typeof window.ActiveXObject == "function") { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } return false; } var httpRequest = new HTTPObjekt; function hentData() { //wid = document.getElementById("workerid").value; wid = 9200; url = base_url + "?page=report&wid=" + wid; if (httpRequest) { httpRequest.open('GET', url, true); httpRequest.onreadystatechange = visInnhold; httpRequest.send(null); } else { window.alert("Har ikke forbindelse."); } } function visInnhold() { try { if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { var xmldok = httpRequest.responseXML; alert(xmldok); } else { window.alert(httpRequest.status); } } } catch(e) { window.alert('Fanget exception: ' + e.description); } } </script> </head> <body> <h1>Øving 14 - AJAX</h1> <form> <input type="text" id="workerid" name="workerid"/> <input type="button" value="Get Jobs" onClick="hentData()"/> </form> <table> <thead> <tr> <td>Worker id</td> <td>Location</td> <td>Job type</td> <td>Start time</td> <td>End time</td> </tr> </thead> <tbody> </tbody> </table> </body></html>