AJAX page working in IE6,7,8 but not in Firefox,Safari and Opera
|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
AJAX page working in IE6,7,8 but not in Firefox,Safari and OperaHi 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:
Code:
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);
}[/code
Thank you very much,
:)
|
|
|
Re: AJAX page working in IE6,7,8 but not in Firefox,Safari and OperaMay I suggest you actually use jQuery ?
var ddlvalue = $('#ddlChannelSelect').val(); This should do the trick. Michel Belleville 2009/10/30 acetrader <salibaray@...>
|
|
|
Re: AJAX page working in IE6,7,8 but not in Firefox,Safari and OperaAnother suggestion : code and debug your JavaScript so that it works on FireFox then and only then try to make it work in IE. You'll get less headaches that way, and you'll write neater JavaScript.
Michel Belleville 2009/10/30 Michel Belleville <michel.belleville@...> May I suggest you actually use jQuery ? |
|
|
Re: AJAX page working in IE6,7,8 but not in Firefox,Safari and Operaacetrader wrote:
> > Hi there, > > 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 ? > Thank you very much, > :) My guess is that the html for your selectbox is <select name="ddlChannelSelect">. IE will (wrongly) return this element when you call getElmentById, but other browsers won't, because that's not really an idea. Just add id="ddlChannelSelect" to your <select> element. And if you're using jQuery, use $('#ddlChannelSelect') instead of getElementById. Jonathan -- Jonathan Vanherpe - Tallieu & Tallieu NV - jonathan@... |
|
|
Re: AJAX page working in IE6,7,8 but not in Firefox,Safari and OperaJonathan Vanherpe (T & T NV) wrote:
> because that's not really an idea s/idea/id/ -- Jonathan Vanherpe - Tallieu & Tallieu NV - jonathan@... |
|
|
Re: AJAX page working in IE6,7,8 but not in Firefox,Safari and OperaHi guys,
thank you very much for your help :) I tried the id tag and value by jquery and now everything's working !!! :) , weird how browser compatabilty works ey,
Thank you guys,
The Ace
|
| Free embeddable forum powered by Nabble | Forum Help |