The issue is as follows:
Everytime I make an ajax call using the script below the error exception is triggered instead of success. As you can see, the XML output is in the correct mime type and character set. The URL is local so there's no cross domain issues. I cannot for the life of me figure out why its returning a null value.
I would really appreciate any help you guys could give. I'm willing to answer any questions.
here is the link to the XML output. Ask you can see, text/xml and UTF-8
here is the link to the test page
function kill_auto_bday(){
document.getElementById('mydiv').value = '';
document.getElementById('mydivid').value = '';
document.getElementById('mydiv').className='show_div';
document.getElementById('mydivid').className='show_div';
document.getElementById('sub_button').className='hide_div';
document.getElementById('this_error_now').className='hide_div';
setdefaultselection();
}
function setdefaultselection(){
for (var i=0; i < document.questionnaire_form.gender.length; i++)
{
if (document.questionnaire_form.gender[i].value == "")
{
document.questionnaire_form.gender[i].selected = true;
}
}
}
function getbdaystuff() {
document.getElementById('this_error_now').className='hide_div';
document.getElementById('mydiv').className='hide_div';
document.getElementById('mydivid').className='hide_div';
document.getElementById('sub_button').className='hide_div';
get_my_bday();
}
function get_my_bday() {
var e = document.getElementById("gender");
var genderselect = e.options[e.selectedIndex].value;
var this_surv_id = document.getElementById("this_surv_id").value;
var bday_day = document.getElementById("bday_day").value;
var bday_month = document.getElementById("bday_month").value;
var bday_year = document.getElementById("bday_year").value;
var fu_url = "/ajax_results.cfm?ajax_type=auto_bday¶m="; // The server-side script
var go_url = fu_url + escape(genderselect)+ '&this_surv_id='+ escape(this_surv_id) + '&bday_day=' + escape(bday_day) + '&bday_month=' + escape(bday_month) + '&bday_year=' + escape(bday_year);
document.getElementById('this_error_now').className='hide_div';
var response_obj = $.ajax({
async: false,
type: 'GET',
dataType: 'xml',
url:'/ajax_results.cfm?ajax_type=auto_bday¶m=1&this_surv_id=656&bday_day=27&bday_month=4&bday_year=1970',
success: function (html) {
alert('successful : ' + html);
},
error: function (error) {
alert('error; ' + eval(error));
});
}
Here is the XML in case you're wondering what it looks like:
<?xml version="1.0" encoding="UTF-8"?>
<mycontent>
<mydiv>No matching division found.</mydiv>
<mydivid>0</mydivid>
</mycontent>