473,698 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Issues with IE & Prototype/AJAX

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 PeriodicalExecu ter(getIncremen ter, 5);
var ud2 = new PeriodicalExecu ter(getMicrotim e, 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').inn erHTML = req.responseTex t;
}

function showMicrotime(r eq)
{
//put returned Text/XML in the textarea
$('microtime_di v').innerHTML = req.responseTex t;
}

Aug 2 '06
17 3151
Ray wrote:
Richard Cornford wrote:
>I would never use Protoytpe.js, I know javascript.
<snip>
What's wrong with Prototype?
It would take too long to explain properly, but it appears to mostly
come down to the authors not really knowing javascript well enough to
appreciate it as a language and instead trying to twist it into
something more like a language that they did appreciate. There is a
Catch 22 in that attitude, in that they would have had to learn to
appreciate javascript before being in a position to do a good job
twisting it to be like their preferred language, at which point they
would no longer have seen a need to make the effort. The inevitable
result of this contradiction is a large collection of interdependent,
brittle, environment limited, inefficient and bulky code.
What do you think of other libraries like
Dojo toolkit or X ?
Libraries are mostly about code re-use, but as a strategy for code
re-use they do not fit well with the nature of browser scripting.
Alternative strategies offer equivalent levels or code re-use (or
better) and are better suited to the necessity of having all the
executable code used downloaded to the browser.

Richard.
Aug 3 '06 #11
Richard Cornford wrote:
da*******@gmail .com wrote:
<snip>
... I forget that they are separate threads ...

You should as javascript is not multithreaded, so they are _not_
separate threads.
What is it then when you fire one or more setTimeout() calls? They
behaves very differently to just continuing with code (other events
will occur, such as a display refresh, for example) and you can have it
fire on user-events, generating multiple timing loops occuring at once.
What is this if not threads?
Richard.
Aug 4 '06 #12

da*******@gmail .com wrote:
Richard Cornford wrote:
da*******@gmail .com wrote:
<snip>
... I forget that they are separate threads ...
You should as javascript is not multithreaded, so they are _not_
separate threads.

What is it then when you fire one or more setTimeout() calls? They
behaves very differently to just continuing with code (other events
will occur, such as a display refresh, for example) and you can have it
fire on user-events, generating multiple timing loops occuring at once.
What is this if not threads?
A queue.

The browser itself may be multi-threaded and most seem to be - they can
fire many HTTP requests and download various parts of a document
simultaneously. The script element's 'defer' attribute seems to have
been inspired by this behaviour, allowing a browser to download other
resources while downloading and executing the script.

Most browsers will not update the screen while a script is running,
which makes sense - why constantly update the screen while DOM
manipulation is occurring? It makes much more sense to wait until all
modifications have occurred and then re-paint the screen once.

In JavaScript, only one thread runs at a time. It has already been
categorically stated in this thread that one JavaScript process can't
interrupt another, therefore neither setTimeout or setInterval can
interrupt an executing process - they must wait until whatever process
is running completes before they run. Otherwise it would be very
simple to use setTimeout to stop an endless loop, e.g.:

var _gobal = this;
function stopProcess(pro cess) {
setTimeout(func tion() _global[process] = null;}, 1000)
}
function endlessLoop() {
stopProcess(arg uments.callee.n ame);
while(true){}
}

If the above did work (and I guarantee it doesn't) then stopProcess()
should be able to cancel the endless loop - but it can't because as
long as endlessLoop() runs, no other script will get a look-in. If it
were possible, I imagine it would be used extensively in debugging.

Of course the *browser* may (and some do) provide another thread that
monitors and optionally cancels a an executing JavaScript process, but
that is a host environment thread, not a second (or third or fourth)
JavaScript thread.
--
Rob

Aug 4 '06 #13
Ray

Richard Cornford wrote:
<snip>
What do you think of other libraries like
Dojo toolkit or X ?

Libraries are mostly about code re-use, but as a strategy for code
re-use they do not fit well with the nature of browser scripting.
Alternative strategies offer equivalent levels or code re-use (or
better) and are better suited to the necessity of having all the
executable code used downloaded to the browser.
Thanks Richard,

Wondering what the alternative strategies to code reuse are, if not
libraries? The moment you separate your oft-used code into a separate
js file and organize them into functions/classes, you have a library,
don't you?

Regards,
Ray
>
Richard.
Aug 4 '06 #14
RobG wrote:
da*******@gmail .com wrote:
Richard Cornford wrote:
da*******@gmail .com wrote:
<snip>
... I forget that they are separate threads ...
>
You should as javascript is not multithreaded, so they are _not_
separate threads.
What is it then when you fire one or more setTimeout() calls? They
behaves very differently to just continuing with code (other events
will occur, such as a display refresh, for example) and you can have it
fire on user-events, generating multiple timing loops occuring at once.
What is this if not threads?

A queue.

The browser itself may be multi-threaded and most seem to be - they can
fire many HTTP requests and download various parts of a document
simultaneously. The script element's 'defer' attribute seems to have
been inspired by this behaviour, allowing a browser to download other
resources while downloading and executing the script.

Most browsers will not update the screen while a script is running,
which makes sense - why constantly update the screen while DOM
manipulation is occurring? It makes much more sense to wait until all
modifications have occurred and then re-paint the screen once.

In JavaScript, only one thread runs at a time. It has already been
categorically stated in this thread that one JavaScript process can't
interrupt another, therefore neither setTimeout or setInterval can
interrupt an executing process - they must wait until whatever process
is running completes before they run. Otherwise it would be very
simple to use setTimeout to stop an endless loop, e.g.:

var _gobal = this;
function stopProcess(pro cess) {
setTimeout(func tion() _global[process] = null;}, 1000)
}
function endlessLoop() {
stopProcess(arg uments.callee.n ame);
while(true){}
}

If the above did work (and I guarantee it doesn't) then stopProcess()
should be able to cancel the endless loop - but it can't because as
long as endlessLoop() runs, no other script will get a look-in. If it
were possible, I imagine it would be used extensively in debugging.

Of course the *browser* may (and some do) provide another thread that
monitors and optionally cancels a an executing JavaScript process, but
that is a host environment thread, not a second (or third or fourth)
JavaScript thread.
How very interesting. I had to write my own infinite loop examples to
understand what you mean, but see how it distinguishes a queue from the
thread. Thanks for the info.

For many practical purposes, you can have the equivalent of multiple
loops running at once, with the gui still responsive while they're
running, using timeouts.

---
http://darwinist.googlepages.com/htmldesktop.html
(A free, open-source web-based IDE, windowing system, and desktop
environment, in 31kB of html and javascript.)
>
--
Rob
Aug 4 '06 #15
Ray wrote:
Wondering what the alternative strategies to code reuse are, if not
libraries? The moment you separate your oft-used code into a separate
js file and organize them into functions/classes, you have a library,
don't you?
Search the google archives of this group for "cornford libraries" and you'll
find many debates on the topic, often with me ;)

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Aug 4 '06 #16
Ray
Thanks Matt!! Will do the search you recommended as well.

Cheers
Ray

Matt Kruse wrote:
Ray wrote:
What's wrong with Prototype?

http://www.javascripttoolbox.com/bes...ces/#prototype

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Aug 4 '06 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9551
by: k.mitz | last post by:
Hi, I have a PHP application that allows users to generate a .pdf report of their database content. Normally, I've had to refresh a page to call the script to generate the report, so there's a second or so when the browser goes blank. I was wondering if it was possible to use AJAX to call the script to generate the report, then begin the download without refreshing the page (or in the case of I.E., leaving me with a blank window that...
3
1672
by: morganwhitney | last post by:
Hi all, I am developing a web app and I am implementing the JavaScript using the Prototype Framework. I have done all the same stuff from scratch in a previous application and it worked fine, but I am having a couple of issues when trying to use Prototype. 1. Parameters are not sent if I specify a transport method: var url = baseurl+'lib/login.php'; var pars = 'login=' + $F('ad_login') + '&passwd=' + $F('passwd'); var myAjax = new...
10
6310
by: Steve | last post by:
I need to build a very dynamic client and would be interested in knowing the pros and cons of using JSF and Ajax to accomplish this. Thanks. Steve
1
1849
by: vachacz | last post by:
hi i'm struggling with integration of a js class aimed for ajax handling with fireing actions from the class. here's my code sample: function AjaxLibLoad(httpActionParam, targetLayerParam){ this.targetLayer = targetLayerParam; this.httpAction = httpActionParam; this.httpRequest = this.httpRequestInstance(); this.load(); };
5
20071
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great with Firefox,but with IE6 the onFailure never gets called and the request never completes. My code: var ajaxReq = new Ajax.Request( url, {method: 'post', parameters:
7
1817
by: BeeRich | last post by:
Hi folks. I built an ajax.updater reply in a website on a Mac, and she works fine. It's a simple reply, the html supplied is correct, and I also supply the target DIV as well. Just wondering why a PC won't show anything. Cheers
5
4185
by: Gerry Vandermaesen | last post by:
Hi, Does anyone have a freely available JavaScript JSON stringifier. So far my search has been in vain, the one offered on http://www.json.org/json.js does not seem to work for me.
23
1760
by: Dautkhanov | last post by:
Hello ! Does anybody have cutted version of prototype.js with the AJAX functionality only? I am a new in prototype.js topic, so I think this task should be done by other developers. Maybe protorype.js should be splitted into small pieces of the js scripts with groupped functionality
3
3579
by: jacobstr | last post by:
I've noticed Object.extend used in a few different ways and I'm having trouble distinguishing why certain usages apply to a given situation. On line 804 Ajax.Base is defined as follows: Ajax.Base = function() {}; Ajax.Base.prototype = { setOptions: function(options) { <...>
0
8675
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8862
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6521
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2331
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.