I have been using a little AJAX technique in a couple places and was having two separate problems that i worked out.
First issue: i have 2 separate html divs that were being reloaded on the same page. The problem i was having is the second call that was informing the second div on the page was sacking the first. In other words, I had come like this calling two different jscript methods
function loadQuestionsStandards(assessmentID,category,type,level){
showStandards(category,type,level);
showQuestions(assessmentID);
}
Each function showStandards() and showQuestions() contains code like this
var url="views/filterQuestions.cfm?&assessmentID=" + AID + "&showAllQuestions=" + flag ;
oXmlHttp=GetHttpObject(updateQuestionList);
oXmlHttp.open("GET", url , true);
where updateQuestionList is the name of a layer in the page called by the url var.
The results of the second call to showQuestions was polulating both divs on the page. Finally, i changed the true property to false in the first method call and it worked.
In other words, the reload of the page only occured once, not twice and it correctly reloaded both layers. I did not find any help around this problem in the blogshere.
The second problem only showed itself in our production environment. Hmmmm, did not occur in our test or staging environments. That remains a puzzle to me. The problem was in the same line of code as the first problem.
oXmlHttp.open("GET", url , true);
When i was trying to solve the first problem, i changed the GET to POST for one of the functions and forgot to change it back. Probably forgot because it did not make a difference until it made it way to production, where it failed gracefully. I got a message back from the Jscript API, i presume, that said Length Required.
I was able to trace the problem back to a specific function where i had made this GET to POST change.
Moral of the story? not sure, but both of these issued had to do with the
oXmlHttp object.
Thursday, August 14, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment