viktorlind
Programmer
Hi guys.
I fell across these forums while looking for help in regards of passing variables. I found a thread that had exactly what I needed (thread216-1264994) however this doesnt work with my code and tbh I cant understand why it wouldnt work.
Here's my code:
I am trying to pass a variable (casenum) from the first function in the ajax process to the second as I want the response to be put in the div called casenum.
Why doesnt this code work? What can I do to fix it?
The problem is that the variables isn't passed so the script halts at the second reply function.
Appreciate any help!
I fell across these forums while looking for help in regards of passing variables. I found a thread that had exactly what I needed (thread216-1264994) however this doesnt work with my code and tbh I cant understand why it wouldnt work.
Here's my code:
Code:
function markCase(casenum) {
nocache = Math.random();
document.getElementById(casenum).style.display = "block";
document.getElementById(casenum).innerHTML = "<img src='media/spinner.gif'/>";
http.open('get', 'include/markCase.php?nocache='+nocache+'&case='+casenum);
http.onreadystatechange = function() { markCaseReply(casenum); };
}
function markCaseReply(casenum) {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById(casenum).innerHTML = response;
}
}
I am trying to pass a variable (casenum) from the first function in the ajax process to the second as I want the response to be put in the div called casenum.
Why doesnt this code work? What can I do to fix it?
The problem is that the variables isn't passed so the script halts at the second reply function.
Appreciate any help!