Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Issues with IE & Prototype/AJAX

Reply
Thread Tools

Issues with IE & Prototype/AJAX

 
 
Steve-O
Guest
Posts: n/a
 
      08-02-2006
The following code works great in FireFox, Opera, Netscape, Safari, and
Gecko, but NOT IE. Why?

I tried using 'native' js with setInterval and setTimeout, but I get
the same result. My IE security settings are not an issue.

Anyone have any insight on this?

Thanks!
-sh
************************************************** ***************
// JavaScript Document
var ud1 = new PeriodicalExecuter(getIncrementer, 5);
var ud2 = new PeriodicalExecuter(getMicrotime, 5);

function getIncrementer()
{
var url = 'filter.htm';
var myAjax = new Ajax.Request( url, { method: 'get', onComplete:
showMyData });
}

function getMicrotime()
{
var url = 'filter2.htm';
var myAjax2 = new Ajax.Request( url, { method: 'get', onComplete:
showMicrotime });
}

function showMyData(req)
{
//put returned Text/XML in the textarea
$('my_div').innerHTML = req.responseText;
}

function showMicrotime(req)
{
//put returned Text/XML in the textarea
$('microtime_div').innerHTML = req.responseText;
}

 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      08-03-2006

Steve-O wrote:
> The following code works great in FireFox, Opera, Netscape, Safari, and
> Gecko, but NOT IE. Why?


For some udisclosed value of 'works' and 'not (works)'.


> I tried using 'native' js with setInterval and setTimeout, but I get
> the same result. My IE security settings are not an issue.


prototype.js is about 1,800 lines of code and you give no hints as to
where the error might be. Post the 'native' js version and you might
get an answer - or ask in a prototype.js news group or forum.

[...]


--
Rob

 
Reply With Quote
 
 
 
 
darwinist@gmail.com
Guest
Posts: n/a
 
      08-03-2006
Steve-O wrote:
> The following code works great in FireFox, Opera, Netscape, Safari, and
> Gecko, but NOT IE. Why?
>
> I tried using 'native' js with setInterval and setTimeout, but I get
> the same result. My IE security settings are not an issue.
>
> Anyone have any insight on this?
>
> Thanks!
> -sh
> ************************************************** ***************
> // JavaScript Document
> var ud1 = new PeriodicalExecuter(getIncrementer, 5);
> var ud2 = new PeriodicalExecuter(getMicrotime, 5);
>
> function getIncrementer()
> {
> var url = 'filter.htm';
> var myAjax = new Ajax.Request( url, { method: 'get', onComplete:
> showMyData });
> }
>
> function getMicrotime()
> {
> var url = 'filter2.htm';
> var myAjax2 = new Ajax.Request( url, { method: 'get', onComplete:
> showMicrotime });
> }
>
> function showMyData(req)
> {
> //put returned Text/XML in the textarea
> $('my_div').innerHTML = req.responseText;
> }
>
> function showMicrotime(req)
> {
> //put returned Text/XML in the textarea
> $('microtime_div').innerHTML = req.responseText;
> }


setTimeout sometimes catches me because I forget that they are separate
threads and that they only run once. If you want to make a sort of
do-events style for-loop type structure using setTimeout instead, you
need two functions.

The first starts it going, eg:
<script> setTimeout(code, time); </script>

the second has to decide whether to set it going again:
<script>
DoStuff()
if (keepgoing) setTimeout(code, time);
</script>

careful that you keep track of if the loops is current executing, eg
with a global variable or something more refined. Else someone might
start the timer twice and you'll get two loops that each spawn two new
ones when they finish. Generally doubles the framerate of whatever you
are updating, but not in a good way.

hth

http://darwinist.googlepages.com/htmldesktop.html

 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      08-03-2006
wrote:
<snip>
> ... I forget that they are separate threads ...


You should as javascript is not multithreaded, so they are _not_
separate threads.

Richard.


 
Reply With Quote
 
Ray
Guest
Posts: n/a
 
      08-03-2006

Richard Cornford wrote:
> wrote:
> <snip>
> > ... I forget that they are separate threads ...

>
> You should as javascript is not multithreaded, so they are _not_
> separate threads.


When you send an AJAX request using Prototype, isn't it done using a
separate thread? I know what you mean about JS (the language) being not
multithreaded though.

>
> Richard.


 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      08-03-2006
Ray wrote:
> Richard Cornford wrote:
>> wrote:
>><snip>
>>> ... I forget that they are separate threads ...

>>
>> You should as javascript is not multithreaded, so they are _not_
>> separate threads.

>
> When you send an AJAX request using Prototype, isn't it done using a
> separate thread?


I would never use Protoytpe.js, I know javascript. The XML HTTP request
objects (at least when making asynchronous requests) must be operating
in what is effectively a separate thread (but they are likely written
in C++). The handling of the response by javascript is not
multithreaded; no executing javascript in the same environment will be
interrupted by/overlap with the response from and XML HTTP request
object and the handling of that response will not be interrupted
by/overlap with event handling code or setTimeout/Interval triggered
code (the latter must wait until the handling of the XML HTTP response
comes to an end).

> I know what you mean about JS (the language) being not
> multithreaded though.


Good, VK is likely to try to make out the javascript is multithreaded
(at least he has often done so in the past) but nobody else is that
foolish.

Richard.

 
Reply With Quote
 
Ray
Guest
Posts: n/a
 
      08-03-2006
Richard Cornford wrote:
<snip>
> The handling of the response by javascript is not
> multithreaded; no executing javascript in the same environment will be
> interrupted by/overlap with the response from and XML HTTP request
> object and the handling of that response will not be interrupted
> by/overlap with event handling code or setTimeout/Interval triggered
> code (the latter must wait until the handling of the XML HTTP response
> comes to an end).


Ah, I didn't know this part. Thanks! That's good to know.

<snip>

 
Reply With Quote
 
Ray
Guest
Posts: n/a
 
      08-03-2006
Richard Cornford wrote:
> I would never use Protoytpe.js, I know javascript. <snip>


What's wrong with Prototype? What do you think of other libraries like
Dojo toolkit or X ?

Thanks,
Ray

> Richard.


 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      08-03-2006
On 03/08/2006 12:05, Ray wrote:

> Richard Cornford wrote:
>
>> I would never use Protoytpe.js, I know javascript. <snip>

>
> What's wrong with Prototype?


There has been at least one thread dedicated to criticism of the
Prototype library[1]. Feel free to browse the archives[2].

> What do you think of other libraries like Dojo toolkit or X ?


I'm not trying to speak for Richard, but his answer is highly likely to
be negative; he dislikes monolithic libraries, as do some other regulars
in this group. You will quickly realise that from browsing the
archives[3]. Perhaps he has specific criticism, though.

I've never used any of them, myself, and only glanced at Prototype long
enough to dislike it.

Mike


[1] prototype.js criticism 2006-03-20 07:26:45 GMT
<. com>
<http://groups.google.co.uk/group/comp.lang.javascript/browse_thread/thread/b699522a97d26a6d/5d5110a25cd79c2e?lnk=st&q=&rnum=2&hl=en#5d5110a25c d79c2e>

[2] Google Groups search results for:
group:comp.lang.javascript prototype library wrong | bad | evil
<http://groups.google.co.uk/groups?lnk=hpsg&hl=en&q=group%3Acomp.lang.javascri pt+prototype+library+wrong+%7C+bad+%7C+evil>

[3] Google Groups search results for:
group:comp.lang.javascript author:"Richard Cornford" libraries
<http://groups.google.co.uk/groups/search?hl=en&q=group%3Acomp.lang.javascript+author %3A%22Richard+Cornford%22+libraries&qt_s=Search>
 
Reply With Quote
 
Ray
Guest
Posts: n/a
 
      08-03-2006

Michael Winter wrote:
> On 03/08/2006 12:05, Ray wrote:
>
> > Richard Cornford wrote:
> >
> >> I would never use Protoytpe.js, I know javascript. <snip>

> >
> > What's wrong with Prototype?

>
> There has been at least one thread dedicated to criticism of the
> Prototype library[1]. Feel free to browse the archives[2].

<snip>

Thanks Michael!! That's going to be educational for me

Cheers
Ray

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows XP Pro clean install issues, SP2 issues too... Howie Computer Support 9 07-12-2005 04:47 PM
Windows XP Pro clean install issues, SP2 issues too... Howie Computer Support 0 07-06-2005 07:12 PM
Re: Windows XP Pro clean install issues, SP2 issues too... pcbutts1 Computer Support 0 07-06-2005 04:58 PM
Re: Windows XP Pro clean install issues, SP2 issues too... pcbutts1 Computer Support 0 07-06-2005 04:52 PM
SNMP Issues in Cisco Routers; Vulnerability Issues in TCP =?iso-8859-1?Q?Frisbee=AE?= MCSE 0 04-21-2004 03:00 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57