Hi I need help with prototype while doing ajax calls. So this is my JS
which does a ajax calls
var ajax1 = new Ajax.Request (
url,
{
method: 'get',
parameters: params,
onComplete: showResults,
onFailure: showFailure
}
);
this calls works fine but i need to know how I can set a timeout saying
after 5 seconds you should give up and show a message to the user how
can this be achieved. I want to achieve this without changing any code
in prototype.js
Does any one have knowledge in using prototype.js to its best, I looked
at this article http://www.sergiopereira.com/articles/prototype.js.html
does anyone know if there is a official documentation for the library.
Last is there a freebie library better than prototype.js
Thank you
C 17 3250
Chaprasi wrote: Hi I need help with prototype while doing ajax calls. So this is my JS which does a ajax calls
Prototype.js is generally avoided by most people in this group.
You won't find much help for it here.
this calls works fine but i need to know how I can set a timeout saying after 5 seconds you should give up and show a message to the user how can this be achieved.
I don't know if prototype supports timeouts, but my AjaxRequest library
does: http://www.ajaxtoolbox.com/request/examples.php
does anyone know if there is a official documentation for the library.
Part of the issue with prototype.js is that the documentation is almost
non-existent and there doesn't seem to be a good support system for the
library. So users end up coming here, for example, which is annoying.
Last is there a freebie library better than prototype.js
Yes. Many :)
--
Matt Kruse http://www.JavascriptToolbox.com http://www.AjaxToolbox.com
Thank you for the response. I know I implemeted prototype.js but I am
open to nice JS libraries which does all the wrapping for doing ajax.
So can you name a few of these libraries which are better than
prototype.
Thanks
C
Chaprasi said the following on 5/23/2006 3:16 PM: Thank you for the response.
Thank you for quoting what you are replying to in the future.
If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.
<URL: http://www.safalra.com/special/googlegroupsreply/ >
I know I implemeted prototype.js but I am open to nice JS libraries which does all the wrapping for doing ajax.
So can you name a few of these libraries which are better than prototype.
*Any* library is better than prototype.
<URL: http://www.ajaxtoolbox.com/>
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Matt Kruse wrote: Chaprasi wrote:
Hi I need help with prototype while doing ajax calls. So this is my JS which does a ajax calls
Prototype.js is generally avoided by most people in this group. You won't find much help for it here.
I haven't really looked at prototype.js - would you mind sharing why
it's generally avoided?
I am not trying to avoid it, I just was thinking if there are better
libraries who can give me handle over timeouts, onerrors.
So far AjaxRequest looks good which is available at http://www.ajaxtoolbox.com/
Tony wrote: Matt Kruse wrote: Chaprasi wrote:
Hi I need help with prototype while doing ajax calls. So this is my JS which does a ajax calls
Prototype.js is generally avoided by most people in this group. You won't find much help for it here.
I haven't really looked at prototype.js - would you mind sharing why it's generally avoided?
Tony wrote: Matt Kruse wrote: Chaprasi wrote:
Hi I need help with prototype while doing ajax calls. So this is my JS which does a ajax calls
Prototype.js is generally avoided by most people in this group. You won't find much help for it here.
I haven't really looked at prototype.js - would you mind sharing why it's generally avoided?
In no particular order:
1. It modifies the protoype of some built-in objects so that
using say, for..in with an array object produces unexpected results.
2. It requires a different syntax, so that instead of using say:
var el = document.getElementById('someID');
you use:
var el = $('someID');
Instead of looping through a number of IDs, you'd use:
var els = $('someID_01', 'someID_02', elRef_03);
3. Having used and become dependent on its syntax, you'll
have to learn 'real' JavaScript at some point.
4. It is utterly undocumented by the author and only very
sparsely commented. Some other attempts at documentation:
<URL:http://blogs.ebusiness-apps.com/jordan/pages/Prototype%20Library%20Info.htm>
<URL:http://www.sergiopereira.com/articles/prototype.js.html>
<URL:http://wiki.script.aculo.us/scriptaculous/show/Prototype>
<URL:http://www.snook.ca/archives/000531.php>
5. There is no support community or blog of any real substance
6. It has about 2,0000 lines of code when only a small subset
might be needed. It is not easy to use only portions,
as many functions are reliant on others. Those dependencies
are not documented.
7. Its feature detection is sparse and it is likely to fail in
many browsers with no chance of recovery
8. It encourages bad coding practice with functions like:
Try.these( func01(...), func02(...), func03(...) );
as a shortcut for multiple try..catch blocks and replacement
for feature detection.
And so on...
--
Rob
Group FAQ: <URL:http://www.jibbering.com/faq/>
I'm not particularly pro prototype.js but
RobG wrote: prototype.js 1. It modifies the protoype of some built-in objects so that using say, for..in with an array object produces unexpected results.
Is the for..in loop problem still a problem or is that something they
have fixed?
5. There is no support community or blog of any real substance
It is possible to try on the rails spinoff list.
-Peter pe**********@gmail.com wrote: I'm not particularly pro prototype.js but
RobG wrote: prototype.js 1. It modifies the protoype of some built-in objects so that using say, for..in with an array object produces unexpected results.
Is the for..in loop problem still a problem or is that something they have fixed?
The official latest version is 1.4, I tested it with 1.5.0_rc0 (see 1.
below). Yes, it's still a problem and likely always will be.
The issue stems from the fact that prototype.js modifies the prototype
of the in-built Array object. The same functionality could have been
achieved by creating a special prototype.js array object (say called
PTArray or _$A or whatever) and modifying that, but that's not how the
author chose to do it.
1. There are 31 extra properties:
each, all, any, collect, detect, findAll, grep, include,
inject, invoke, max, min, partition, pluck, reject, sortBy,
toArray, zip, inspect, find, select, member, entries, _reverse,
_each, clear, first, last, compact, flatten, without
--
Rob
Group FAQ: <URL:http://www.jibbering.com/faq/>
RobG wrote:
<snip> 2. It requires a different syntax, so that instead of using say:
var el = document.getElementById('someID');
you use:
var el = $('someID');
<snip>
That is also function name chosen with a disregard for the convention
laid out in the ECMAScript specification where all Identifiers beginning
with '$' are intended it indicate machine generated Identifiers. No
reasonable javascript code should be written without a regard for that
obviously well known/understood convention.
Richard.
RobG wrote: Tony wrote: I haven't really looked at prototype.js - would you mind sharing why it's generally avoided?
In no particular order:
<list of pretty bad stuff>
Ouch - I can understand why it's not well-liked here.
Guys now I am using AjaxRequest library and the timeout does not work
when I set async: false, it works for async calls
AjaxRequest.get (
{
'async': false,
'url': 'some url which requests a page that takes 10 secs to
load',
'timeout': 2000,
'onSuccess': 'some sucess which works',
'onTimeout': function(req) { alert('Timed out'); }
}
)
What am I doing wrong?
Thanks,
C
Matt Kruse wrote: Chaprasi wrote: Hi I need help with prototype while doing ajax calls. So this is my JS which does a ajax calls
Prototype.js is generally avoided by most people in this group. You won't find much help for it here.
this calls works fine but i need to know how I can set a timeout saying after 5 seconds you should give up and show a message to the user how can this be achieved.
I don't know if prototype supports timeouts, but my AjaxRequest library does: http://www.ajaxtoolbox.com/request/examples.php
does anyone know if there is a official documentation for the library.
Part of the issue with prototype.js is that the documentation is almost non-existent and there doesn't seem to be a good support system for the library. So users end up coming here, for example, which is annoying.
Last is there a freebie library better than prototype.js
Yes. Many :)
-- Matt Kruse http://www.JavascriptToolbox.com http://www.AjaxToolbox.com
RobG <rg***@iinet.net.au> writes: The issue stems from the fact that prototype.js modifies the prototype of the in-built Array object. The same functionality could have been achieved by creating a special prototype.js array object (say called PTArray or _$A or whatever) and modifying that, but that's not how the author chose to do it.
How would that work? Would "new PTArray" create and return a new
normal array and assign all the extra methods on each creation?
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Lasse Reichstein Nielsen wrote: RobG writes:
<snip> The same functionality could have been achieved by creating a special prototype.js array object (say called PTArray ...
<snip>
How would that work? Would "new PTArray" create and return a new normal array and assign all the extra methods on each creation?
It would pretty much have to as that is the only way of having an
object with the Array's special [[Put]] method. But why not as the
augmentation is only a set of assignments.
Richard.
try the following line right after you above code:
setTimeout( function(){
ajax1.transport.abort();
alert('Sorry, dude. I gave up on the call.');
} , 5000);
- Sergio Pereira
Guys any idea why this call is failing in Firefox, but in Internet
explorer it works fine.
AjaxRequest.get (
{
'async': false,
'url': 'some url which requests a page that takes 10 secs to
load',
'timeout': 2000,
'onSuccess': function(req) { alert('Sucess'); },
'onTimeout': function(req) { alert('Timed out'); }
}
)
So in IE this call is success but not in firefox. :(
Thanks,
C se*******@gmail.com wrote: try the following line right after you above code:
setTimeout( function(){ ajax1.transport.abort(); alert('Sorry, dude. I gave up on the call.'); } , 5000);
- Sergio Pereira
Chaprasi wrote: Guys any idea why this call is failing in Firefox, but in Internet explorer it works fine. AjaxRequest.get ( { 'async': false, 'url': 'some url which requests a page that takes 10 secs to load', 'timeout': 2000,
First of all, don't use async:false. It's generally a Bad Thing.
Second, a timeout won't work here because all code stops and waits for the
request to finish (thus, sync).
Simplify your problem: Use async.
--
Matt Kruse http://www.JavascriptToolbox.com http://www.AjaxToolbox.com
I agree with what you are saying. So how do I fire a validation check
where I need a response from the server like validating zip codes
without posting the form back. And what happens if this call times out
or if there is any network errors, how do I track those?
Can that be achieved with AjaxRequest?
Thanks,
C
Matt Kruse wrote: Chaprasi wrote: Guys any idea why this call is failing in Firefox, but in Internet explorer it works fine. AjaxRequest.get ( { 'async': false, 'url': 'some url which requests a page that takes 10 secs to load', 'timeout': 2000,
First of all, don't use async:false. It's generally a Bad Thing.
Second, a timeout won't work here because all code stops and waits for the request to finish (thus, sync).
Simplify your problem: Use async.
-- Matt Kruse http://www.JavascriptToolbox.com http://www.AjaxToolbox.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: p2esp |
last post by:
Hello,
I'm using the xmlrpclib module to contact an XMLRPC
server that takes a long time to send results back. My
client timeouts.
The question is whether there is a way to have an
xmlrpclib...
|
by: Laphan |
last post by:
Hi Guys
I've been using text files for Tab-Delimited/ADO/ASP sites so that users can
update and display their products lists through my system with relative
ease.
Only problem is that for the...
|
by: mircu |
last post by:
Hi,
I need a quick solution to make my application behave correctly when one
of these timeouts occurs. I have some logic in session_start but when
the authentication cookie timeouts the user is...
|
by: Fraijo |
last post by:
how can i disable session timeouts without affecting any program codings?
|
by: AV |
last post by:
I have a web server in production running IIS 6 (Windows Server 2003 SP1) and hosting multiple virtual websites with each website hosting many ASP.NET applications in virtual directories. Each...
|
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...
|
by: webdevaccount |
last post by:
Hello,
I am using a Timer and an UpdatePanel control. The Timer is set to
1000 milliseconds, and therefore results in many server request
timeouts error (logical). The Server Request Timeout...
|
by: Lloyd Sheen |
last post by:
It seems that debugging AJAX Web services is about impossible. I have
googled and found the Sys.Net.WebRequestManager.set_defaultTimeout call. I
set the value to 15000 which is supposed to be 15...
|
by: Zytan |
last post by:
I have a TcpClient. I set the read/write timeouts at 1 minute (in
milliseconds). I get a NetworkStream from it and confirm the timeouts
still exist. I do a NetworkStream.Write() and then a...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
| |