PDA

View Full Version : AJAX page working in IE6,7,8 but not in Firefox,Safari and Opera



acetrader
10-30-2009, 11:12 AM
Hi there,

I am not a guru jquery coder and still have to learn alot, recently while learning jquery AJAX I have bumped into a weired issue, I have a apge right and in this page I have a dropdown list for people to select an RSS channel that they wish to know more about, the dropdownlist ahs an onChange event which when triggered it will get the value of the selected item in teh dropdownlist and post it to the other 'mini' pages that load on the same page via AJAX by using the GET method - ie: im passing the parameters like a normal querystring would.

The problem is that when I assign the dropdown value to a variable called dropdown in the following line of code "
var dropdown = document.getElementById('ddlChannelSelect');" it works in IE but not in the other browsers, I have debbugged this in FireBug and it seems that the variable dropdownlist is not actually getting the value of the actual dropdownlist nad it says 'null' or sometimes 'undefined'. Am I doing something wrong ? why is it that it is working in IE but not in other browsers ? can you pls give me a solution with some examples ?

this is the function that I have btw:



function loadChannelAndFeeds()
{
var dropdown = document.getElementById('ddlChannelSelect');
var index = dropdown.selectedIndex;
var ddlvalue = dropdown[index].value;

/*var ddlvalue = document.getElementById('ddlChannelSelect').value*/
var loadChannelOverviewUrl = "apmMaterial/apmFeeds/rss2.0/channelOverview.php";
var loadChannelNoteUrl = "apmMaterial/apmFeeds/rss2.0/widget_channelNote.php";
var loadFeedsUrl = "rssViewFeeds.php";
$("#channelNote").html(ajax_load).load(loadChannelNoteUrl , "channelID="+ddlvalue);
$("#choChannelOverviewContainer").html(ajax_load).load(loadChannelOverviewUrl , "channelID="+ddlvalue);
$("#feedBox_Result").html(ajax_load).load(loadFeedsUrl , "channelID="+ddlvalue);
}

Thank you very much,
:)

codeexploiter
10-30-2009, 11:53 AM
The following line is not correct


var ddlvalue = dropdown[index].value;

It should be


var ddlvalue = dropdown.options[index].value;

If you can provide an online page address that would be a lot easier for the forum users.

Hope this helps.