473,729 Members | 2,405 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 3154
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
9554
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
1674
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
6313
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
1854
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
20077
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
1819
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
1767
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
3583
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
8763
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
9427
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
9284
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9202
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9148
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...
0
8151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4528
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
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
3
2165
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.