AJAX vs IE issue

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: AJAX vs IE issue

 
0
  #11
Aug 15th, 2008
Weird. I thought declaring variables in JavaScript was more of a "good practice" than a requirement. I always do it but wouldn't think that it would break the script.
Lost time is never found again.
- Benjamin Franklin
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: AJAX vs IE issue

 
0
  #12
Aug 15th, 2008
I agree, that is weird

If I understand correctly, declaring a var within a function block changes the scope of the variable from the global scope (window) to the local scope (function), thus avoids namespace collisions if you have like-variable names in the global scope. Maybe this is why it worked in my environment, I didn't have any other javascript on the page besides this function.

??? Glad you got it to work though !!!

:-)
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: AJAX vs IE issue

 
0
  #13
Aug 15th, 2008
Originally Posted by Ciubhran View Post
If I declare "var xmlHttp" as a global, it only works in FF. If I declare it inside of makePOSTRequest (like the above example), then it only works in IE.
I read that declaring it in the global scope (outside the function body) will produce errors if you try and reuse the xmlHttp object, so place it in your function and re-declare it as null for each use.

Did you change the values of your alertContents function from xmlHttp to this, when the xmlHttp is no longer in the global scope (when it is declared in the function)?

IF not your function might have trouble seeing those values ?

I'm tired, sorry I can't be of more help ... but it was working in all of my browsers earlier today.

G'night
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 7
Reputation: Ciubhran is an unknown quantity at this point 
Solved Threads: 0
Ciubhran Ciubhran is offline Offline
Newbie Poster

Re: AJAX vs IE issue

 
0
  #14
Aug 15th, 2008
Got it to work now. Thanks for all the help.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 46
Reputation: chaosprime is an unknown quantity at this point 
Solved Threads: 4
chaosprime's Avatar
chaosprime chaosprime is offline Offline
Light Poster

Re: AJAX vs IE issue

 
0
  #15
Aug 15th, 2008
On the global/local declaration issue, one of the things going on is that Firefox's JS interpreter correctly handles variable scope (the variable only exists inside of the scope where it's declared) and IE's does not (all variables are effectively global).
Chaos
Lost Souls: text based RPG
MUDseek: MUD gaming search
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum


Views: 2854 | Replies: 14
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC