jQuery: The Write Less, Do More JavaScript Library

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 Opera

by acetrader :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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: 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 Opera

by Michel Belleville :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

May I suggest you actually use jQuery ?

var ddlvalue = $('#ddlChannelSelect').val();

This should do the trick.

Michel Belleville


2009/10/30 acetrader <salibaray@...>

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:

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";
                       AceTrader       $("#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,
 :)
--
View this message in context: http://old.nabble.com/AJAX-page-working-in-IE6%2C7%2C8-but-not-in-Firefox%2CSafari-and-Opera-tp26128182s27240p26128182.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



Re: AJAX page working in IE6,7,8 but not in Firefox,Safari and Opera

by Michel Belleville :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Another 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 ?

var ddlvalue = $('#ddlChannelSelect').val();

This should do the trick.

Michel Belleville


2009/10/30 acetrader <salibaray@...>


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:

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";
                       AceTrader       $("#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,
 :)
--
View this message in context: http://old.nabble.com/AJAX-page-working-in-IE6%2C7%2C8-but-not-in-Firefox%2CSafari-and-Opera-tp26128182s27240p26128182.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.




Re: AJAX page working in IE6,7,8 but not in Firefox,Safari and Opera

by Jonathan Vanherpe (T & T NV) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

acetrader 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 ?
[snip]
> 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 Opera

by Jonathan Vanherpe (T & T NV) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jonathan 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 Opera

by acetrader :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi 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