var isIE = false; var req; function loadXMLDoc(url, whichdiv, dowhat, whichjobdiv, jobid) { // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(null); // branch for IE/Windows ActiveX version } else if (window.ActiveXObject) { isIE = true; req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = processReqChange; req.open("GET", url, true); req.send(); } } if (dowhat=='add') { //document.getElementById(whichdiv).innerHTML = "job added"; document.getElementById(whichdiv).innerHTML = "take off shortlist"; document.getElementById(whichjobdiv).style.backgroundColor='#00B7F1'; //document.getElementById("debug").innerHTML = req.responseText; // alert(whichdiv); } else if (dowhat=='remove') { //document.getElementById(whichdiv).innerHTML = "job removed"; document.getElementById(whichdiv).innerHTML = "add to shortlist"; document.getElementById(whichjobdiv).style.backgroundColor='#ffffff'; } } function processReqChange() { // only if req shows "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { // document.getElementById("shortlist").innerHTML = req.responseText; } else { alert("There was a problem retrieving the XML data:\n" + req.statusText); } } } // JavaScript:loadXMLDoc('/ecmselection/public_html/jobs/shortlist.php?new_mjbdata_ref=99&job_id=167','adsl167','add','jd0','167'); // JavaScript:loadXMLDoc('/ecmselection/public_html/jobs/shortlist.php?new_mjbdata_ref=99&job_id=167','adsl167','add','jd0', );