krraleigh
11-12-2008, 04:26 AM
I have the AJAX setup at least I think I do, but for some reason it is creating an error. I highlighted the error in red. the code ...
function createRequestObject(){
var ajaxRequest = false;
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
return false;
}
}
}
}
function setPatientValue (theValue) {
var volunteerMemberId = form.volunteerMemberId;
var patientMemberId = form.memberId;
var xmlhttp = createRequestObject();
var obj = document.getElementById(theValue);
xmlhttp.open('get','loadPatient.php?memberId=' + volunteerMemberId+'&patientId='+patientMemberId); xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status = 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
try
{
if(http.readyState == 4){ //Finished loading the response
/* We have got the response from the server-side script,
let's see just what it was. using the responseText property of
the XMLHttpRequest object. */
var response = http.responseText;
//alert(response);
if(response!="ok")
{
alert(response);
}
}
}
catch(Exception)
{
;
}
} //end setPatientValue()
The error is telling me that the following is incorrectly coded:
xmlhttp.open('get','loadPatient.php?memberId=' + volunteerMemberId+'&patientId='+patientMemberId);
I am calling the function using:
<a href='findPatient.php' onclick='setPatientValue(patientValues);'>Select Patient</a>
to load this <div>:
<div class='patientValues' id='patientValues'></div
Can you advise?
I have been staring at this code for most of the night and I just can't see any errors.
any insight would be greatly appreciated
Thank You
Kevin
function createRequestObject(){
var ajaxRequest = false;
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
return false;
}
}
}
}
function setPatientValue (theValue) {
var volunteerMemberId = form.volunteerMemberId;
var patientMemberId = form.memberId;
var xmlhttp = createRequestObject();
var obj = document.getElementById(theValue);
xmlhttp.open('get','loadPatient.php?memberId=' + volunteerMemberId+'&patientId='+patientMemberId); xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status = 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
try
{
if(http.readyState == 4){ //Finished loading the response
/* We have got the response from the server-side script,
let's see just what it was. using the responseText property of
the XMLHttpRequest object. */
var response = http.responseText;
//alert(response);
if(response!="ok")
{
alert(response);
}
}
}
catch(Exception)
{
;
}
} //end setPatientValue()
The error is telling me that the following is incorrectly coded:
xmlhttp.open('get','loadPatient.php?memberId=' + volunteerMemberId+'&patientId='+patientMemberId);
I am calling the function using:
<a href='findPatient.php' onclick='setPatientValue(patientValues);'>Select Patient</a>
to load this <div>:
<div class='patientValues' id='patientValues'></div
Can you advise?
I have been staring at this code for most of the night and I just can't see any errors.
any insight would be greatly appreciated
Thank You
Kevin