J
Joel Byrd
I am making an AJAX call when any one of a number of inputs in a form
(search criteria) are clicked, checked, changed, etc. When the user
clicks, checks, whatever, I am trying to display a "Retrieving
results..." text. This should be really simple, but in IE, it does not
work. Here's the code that is not executing in IE:
[-----------------------
var status_text = document.getElementById('status_text');
status_text.innerHTML = '<strong>Retrieving Users<span
id="waiting"><img src="images/waiting.gif" align="bottom"
style="margin-left: 5px;" /></span></strong>';
document.getElementById("waiting").style.display='inline';
-------------------------]
And here is the context of that code, which is the AJAX function that
is called when a radio button is clicked, a checkbox is checked, etc.
(there's a long list of variables that I was going to leave out, but I
included everything just in case):
[-------------------------
function friendSearch() {
var status_text = document.getElementById('status_text');
status_text.innerHTML = '<strong>Retrieving Users<span
id="waiting"><img src="images/waiting.gif" align="bottom"
style="margin-left: 5px;" /></span></strong>';
document.getElementById("waiting").style.display='inline';
//First, get all the values from the form.
var browse_what =
findChecked(document.search_users.browse_what);
var sex = findChecked(document.search_users.sex);
var age_min = document.search_users.age_min.value;
var age_max = document.search_users.age_max.value;
var marital_status =
findChecked(document.search_users.marital_status);
var are_here_for =
findChecked(document.search_users.are_here_for);
var hair_color = findChecked(document.search_users.hair_color);
var eye_color = findChecked(document.search_users.eye_color);
var body_type = findChecked(document.search_users.body_type);
var ethnicity = findChecked(document.search_users.ethnicity);
var education = findChecked(document.search_users.education);
var height = findChecked(document.search_users.height);
var height_min_feet = document.search_users.height_min_feet.value;
var height_min_inches = document.search_users.height_min_inches.value;
var height_max_feet = document.search_users.height_max_feet.value;
var height_max_inches = document.search_users.height_max_inches.value;
var rating_min = document.search_users.rating_min.value;
var rating_max = document.search_users.rating_max.value;
var smoker = findChecked(document.search_users.smoker);
var drinker = findChecked(document.search_users.drinker);
var religion = document.search_users.religion.value;
var income = document.search_users.income.value;
var children = document.search_users.children.value;
var show_only_users_with_photos =
findChecked(document.search_users.show_only_users_with_photos);
var show_name_and_photo_only =
findChecked(document.search_users.show_name_and_photo_only);
var sort_by =
findChecked(document.search_users.sortby);
//Then, use ajax to commit the update.
var randomNumber = Math.floor(Math.random() * 9999999);
var page_url = 'ajax.friend_search.php?r=' + randomNumber;
page_url += '&browse_what=' + browse_what;
page_url += '&sex=' + sex;
page_url += '&age_min=' + age_min;
page_url += '&age_max=' + age_max;
page_url += '&marital_status=' + marital_status;
page_url += '&are_here_for=' + are_here_for;
page_url += '&hair_color=' + hair_color;
page_url += '&eye_color=' + eye_color;
page_url += '&body_type=' + body_type;
page_url += 'ðnicity=' + ethnicity;
page_url += '&education=' + education;
page_url += '&height=' + height;
page_url += '&height_min_feet=' + height_min_feet;
page_url += '&height_min_inches=' + height_min_inches;
page_url += '&height_max_feet=' + height_max_feet;
page_url += '&height_max_inches=' + height_max_inches;
page_url += '&rating_min=' + rating_min;
page_url += '&rating_max=' + rating_max;
page_url += '&smoker=' + smoker;
page_url += '&drinker=' + drinker;
page_url += '&religion=' + religion;
page_url += '&income=' + income;
page_url += '&children=' + children;
page_url += '&show_only_users_with_photos=' +
show_only_users_with_photos;
page_url += '&show_name_and_photo_only=' +
show_name_and_photo_only;
page_url += '&sort_by=' + sort_by;
var oAJAX = new XMLHttpRequest();
oAJAX.open("GET", page_url);
oAJAX.onreadystatechange = function() {
if (oAJAX.readyState == 4) {
if (oAJAX.status == 200) {
//Remove status text (it will be replaced by the responseText).
status_text.parentNode.removeChild(status_text);
document.getElementById('search_results').innerHTML =
oAJAX.responseText;
} else {
//document.getElementById("errormsg").childNodes[0].nodeValue =
'There was a problem retrieving the data you requested (Error: ' +
oAJAX.statusText + '). Please try again later.';
}
}
}
oAJAX.send(null);
}//end function friendSearch
---------------------------]
So IE successfully makes the AJAX call and returns the results, but it
just does not execute that first part of the code that displays the
"Retrieving results..." text.
Any ideas?
(search criteria) are clicked, checked, changed, etc. When the user
clicks, checks, whatever, I am trying to display a "Retrieving
results..." text. This should be really simple, but in IE, it does not
work. Here's the code that is not executing in IE:
[-----------------------
var status_text = document.getElementById('status_text');
status_text.innerHTML = '<strong>Retrieving Users<span
id="waiting"><img src="images/waiting.gif" align="bottom"
style="margin-left: 5px;" /></span></strong>';
document.getElementById("waiting").style.display='inline';
-------------------------]
And here is the context of that code, which is the AJAX function that
is called when a radio button is clicked, a checkbox is checked, etc.
(there's a long list of variables that I was going to leave out, but I
included everything just in case):
[-------------------------
function friendSearch() {
var status_text = document.getElementById('status_text');
status_text.innerHTML = '<strong>Retrieving Users<span
id="waiting"><img src="images/waiting.gif" align="bottom"
style="margin-left: 5px;" /></span></strong>';
document.getElementById("waiting").style.display='inline';
//First, get all the values from the form.
var browse_what =
findChecked(document.search_users.browse_what);
var sex = findChecked(document.search_users.sex);
var age_min = document.search_users.age_min.value;
var age_max = document.search_users.age_max.value;
var marital_status =
findChecked(document.search_users.marital_status);
var are_here_for =
findChecked(document.search_users.are_here_for);
var hair_color = findChecked(document.search_users.hair_color);
var eye_color = findChecked(document.search_users.eye_color);
var body_type = findChecked(document.search_users.body_type);
var ethnicity = findChecked(document.search_users.ethnicity);
var education = findChecked(document.search_users.education);
var height = findChecked(document.search_users.height);
var height_min_feet = document.search_users.height_min_feet.value;
var height_min_inches = document.search_users.height_min_inches.value;
var height_max_feet = document.search_users.height_max_feet.value;
var height_max_inches = document.search_users.height_max_inches.value;
var rating_min = document.search_users.rating_min.value;
var rating_max = document.search_users.rating_max.value;
var smoker = findChecked(document.search_users.smoker);
var drinker = findChecked(document.search_users.drinker);
var religion = document.search_users.religion.value;
var income = document.search_users.income.value;
var children = document.search_users.children.value;
var show_only_users_with_photos =
findChecked(document.search_users.show_only_users_with_photos);
var show_name_and_photo_only =
findChecked(document.search_users.show_name_and_photo_only);
var sort_by =
findChecked(document.search_users.sortby);
//Then, use ajax to commit the update.
var randomNumber = Math.floor(Math.random() * 9999999);
var page_url = 'ajax.friend_search.php?r=' + randomNumber;
page_url += '&browse_what=' + browse_what;
page_url += '&sex=' + sex;
page_url += '&age_min=' + age_min;
page_url += '&age_max=' + age_max;
page_url += '&marital_status=' + marital_status;
page_url += '&are_here_for=' + are_here_for;
page_url += '&hair_color=' + hair_color;
page_url += '&eye_color=' + eye_color;
page_url += '&body_type=' + body_type;
page_url += 'ðnicity=' + ethnicity;
page_url += '&education=' + education;
page_url += '&height=' + height;
page_url += '&height_min_feet=' + height_min_feet;
page_url += '&height_min_inches=' + height_min_inches;
page_url += '&height_max_feet=' + height_max_feet;
page_url += '&height_max_inches=' + height_max_inches;
page_url += '&rating_min=' + rating_min;
page_url += '&rating_max=' + rating_max;
page_url += '&smoker=' + smoker;
page_url += '&drinker=' + drinker;
page_url += '&religion=' + religion;
page_url += '&income=' + income;
page_url += '&children=' + children;
page_url += '&show_only_users_with_photos=' +
show_only_users_with_photos;
page_url += '&show_name_and_photo_only=' +
show_name_and_photo_only;
page_url += '&sort_by=' + sort_by;
var oAJAX = new XMLHttpRequest();
oAJAX.open("GET", page_url);
oAJAX.onreadystatechange = function() {
if (oAJAX.readyState == 4) {
if (oAJAX.status == 200) {
//Remove status text (it will be replaced by the responseText).
status_text.parentNode.removeChild(status_text);
document.getElementById('search_results').innerHTML =
oAJAX.responseText;
} else {
//document.getElementById("errormsg").childNodes[0].nodeValue =
'There was a problem retrieving the data you requested (Error: ' +
oAJAX.statusText + '). Please try again later.';
}
}
}
oAJAX.send(null);
}//end function friendSearch
---------------------------]
So IE successfully makes the AJAX call and returns the results, but it
just does not execute that first part of the code that displays the
"Retrieving results..." text.
Any ideas?