D
DonO
I have a directory profile page that has the option of viewing
additional info like the hardware assigned to an individual, the
programs they've been trained on, etc. To display each of these
options, I have created an external PHP page that I pass the info type
I'm looking for, and the user's id. The returned info should come back
to specific ID of a DIV tag.
I can't seem to get it to return to a pre-specified DIV though without
setting up separate responses.
The caller looks like...
<a href="#" onclick="load_external_data('it_hwsw', '<?=$id?>'); return
false;">Display Assigned Hardware</a>
<div id="it_hwsw_detail"></div>
The JS code I've cobbled together is here....
<script type="text/javascript">
function createRequestObject() {
if(navigator.appName == "Microsoft Internet Explorer"){
var ro = new ActiveXObject("Microsoft.XMLHTTP");
}
else{
var ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
function load_external_data(inUpdateElement, inEmpID) {
http.open('get', 'AJAX_load_element.php?element='+inUpdateElement
+'&empID='+inEmpID);
switch(inUpdateElement){
case "it_training" :
http.onreadystatechange = handleResponse1;
break;
case "it_hwsw" :
http.onreadystatechange = handleResponse2;
break;
case "hr_acknowledgement" :
http.onreadystatechange = handleResponse3;
break;
}
//http.updateElementName = inUpdateElement + "_detail";
http.send(null);
}
function handleResponse1() {
if(http.readyState == 4){
document.getElementById('it_training_detail').innerHTML =
http.responseText;
}
}
function handleResponse2() {
if(http.readyState == 4){
document.getElementById('it_hwsw_detail').innerHTML =
http.responseText;
}
}
function handleResponse3() {
if(http.readyState == 4){
document.getElementById('hr_acknowledgement_detail').innerHTML =
http.responseText;
}
}
</script>
additional info like the hardware assigned to an individual, the
programs they've been trained on, etc. To display each of these
options, I have created an external PHP page that I pass the info type
I'm looking for, and the user's id. The returned info should come back
to specific ID of a DIV tag.
I can't seem to get it to return to a pre-specified DIV though without
setting up separate responses.
The caller looks like...
<a href="#" onclick="load_external_data('it_hwsw', '<?=$id?>'); return
false;">Display Assigned Hardware</a>
<div id="it_hwsw_detail"></div>
The JS code I've cobbled together is here....
<script type="text/javascript">
function createRequestObject() {
if(navigator.appName == "Microsoft Internet Explorer"){
var ro = new ActiveXObject("Microsoft.XMLHTTP");
}
else{
var ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
function load_external_data(inUpdateElement, inEmpID) {
http.open('get', 'AJAX_load_element.php?element='+inUpdateElement
+'&empID='+inEmpID);
switch(inUpdateElement){
case "it_training" :
http.onreadystatechange = handleResponse1;
break;
case "it_hwsw" :
http.onreadystatechange = handleResponse2;
break;
case "hr_acknowledgement" :
http.onreadystatechange = handleResponse3;
break;
}
//http.updateElementName = inUpdateElement + "_detail";
http.send(null);
}
function handleResponse1() {
if(http.readyState == 4){
document.getElementById('it_training_detail').innerHTML =
http.responseText;
}
}
function handleResponse2() {
if(http.readyState == 4){
document.getElementById('it_hwsw_detail').innerHTML =
http.responseText;
}
}
function handleResponse3() {
if(http.readyState == 4){
document.getElementById('hr_acknowledgement_detail').innerHTML =
http.responseText;
}
}
</script>