Re: Using XMLHttpRequest in Firefox
- From: "Trevor L." <Trevor L.@Canberra>
- Date: Sun, 22 Jan 2006 10:56:39 +1100
Martin Honnen wrote:
> Trevor L. wrote:
>
>> I pulled the example below from w3schools and made a few cosmetic
>> changes
>
>> if (window.XMLHttpRequest) // NOTE: THIS PATH DOES NOT WORK IN
>> FIREFOX { alert('XMLHttpRequest')
>> xmlhttp = new XMLHttpRequest()
>> if (document.onreadystatechange)
>> xmlhttp.onreadystatechange = state_Change
>> else
>> alert ('document.onreadystatechange not found') // NOTE:
>> THIS ALERT DISPLAYS IN FIREFOX
>
> I don't know the original script but if that if/else is one of your
> "cosmetical changes" then throw it out, it is crap, you need to set
> onreadystatechange on the request object whether that is MSXML or
> Mozilla or any other implementation and you want to do asynchronous
> requests. And document.onreadystatechange does not matter in any way
> for XMLHttpRequest.
>
> See
> <http://www.faqts.com/knowledge_base/view.phtml/aid/6826/fid/616>
> for code that works and has much less code forks, creation of the
> request object is all that is different.
Yes, I put in the if else.
Originally there was no 'if'. By putting in the 'else' I determined that
this was the point where it failed.
Because it failed here, it seems to indicate that onreadystatechange is not
a valid Firefox construct. Am I wrong ?
I have been looking at the reference, and I will try to use it, but if
onreadystatechange fails in Firefox, I can't see how it will work. Do I just
*not* use it in Firefox?
Am I not doing asynchronous requests?
If not, what did I do wrong?
--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au
.
- References:
- Using XMLHttpRequest in Firefox
- From: Trevor L.
- Re: Using XMLHttpRequest in Firefox
- From: Martin Honnen
- Using XMLHttpRequest in Firefox
- Prev by Date: Re: Best Way to access Input fields
- Next by Date: Re: Using XMLHttpRequest in Firefox
- Previous by thread: Re: Using XMLHttpRequest in Firefox
- Next by thread: Re: Using XMLHttpRequest in Firefox
- Index(es):
Relevant Pages
|