Re: [jQuery] Understanding $.ajaxTimeout

2006-09-09 Thread Arash Yalpani
John said:

Yep - this is using the same data that's on /api/ so it also doesn't
have the aforementioned methods. I'm working to document them, sorry
for the delay.


John, thanks for documenting all the stuff! But to be honest, I still 
have no clue, how to use $.ajaxTimeout properly. Obviously, it times out 
any pending connections but how can I react on that?

What I try is to show the user a message like Connection to the server 
has been lost.
Anybody out there with a simple code sample? :)

Thanks, Arash

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-09 Thread John Resig
 John, thanks for documenting all the stuff! But to be honest, I still
 have no clue, how to use $.ajaxTimeout properly. Obviously, it times out
 any pending connections but how can I react on that?

 What I try is to show the user a message like Connection to the server
 has been lost.
 Anybody out there with a simple code sample? :)

Oh - sorry about that, something like this:

$.ajaxTimeout( 5000 );

$.ajax({
url: doesnotexist.html,
error: function( req, msg ) {
if ( msg == timeout )
alert( Connection to server lost. );
}
});

I'm realizing now that I pass the message in to the second argument -
it should be the first. I'll change that in a later version, but it's
nothing major. Hope that helps.

--John

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-09 Thread Klaus Hartl


John Resig schrieb:
 John, thanks for documenting all the stuff! But to be honest, I still
 have no clue, how to use $.ajaxTimeout properly. Obviously, it times out
 any pending connections but how can I react on that?

 What I try is to show the user a message like Connection to the server
 has been lost.
 Anybody out there with a simple code sample? :)
 
 Oh - sorry about that, something like this:
 
 $.ajaxTimeout( 5000 );
 
 $.ajax({
 url: doesnotexist.html,
 error: function( req, msg ) {
 if ( msg == timeout )
 alert( Connection to server lost. );
 }
 });
 
 I'm realizing now that I pass the message in to the second argument -
 it should be the first. I'll change that in a later version, but it's
 nothing major. Hope that helps.
 
 --John


The timeout is global, right? Maybe this gives some more flexibility:

$.ajax({
 ...
 timeout: 5000, // overrides $.ajaxTimeout
 
});

What do you think?


-- klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-09 Thread John Resig
 The timeout is global, right? Maybe this gives some more flexibility:

 $.ajax({
  ...
  timeout: 5000, // overrides $.ajaxTimeout
  
 });

 What do you think?

Sure, certainly a possibility. I'm not sure why I didn't have that
initially. Ticket:
http://jquery.com/dev/bugs/bug/195/

--John

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-09 Thread Arash Yalpani
Hi John,

Oh - sorry about that, something like this:

$.ajaxTimeout( 5000 );

$.ajax({
url: doesnotexist.html,
error: function( req, msg ) {
if ( msg == timeout )
alert( Connection to server lost. );
}
});
  

thank you, but it's not working for me. Maybe I am misinterpreting 
something... I load the page in my browser, disconnect from network, 
start an ajax-request and wait for 5000 milliseconds. What happens is 
that $.ajaxStop is correctly called, but none of the others (complete, 
success, error). If I choose doesnotexist.html as a url, like in your 
example, the error-Handler is called, but with a value of error 
instead of timeout.

I'm realizing now that I pass the message in to the second argument -
it should be the first. I'll change that in a later version, but it's
nothing major. Hope that helps.
  

Almost :-)
Cheers, Arash

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-09 Thread Arash Yalpani
Hi John,

John Resig schrieb:

Ok - currently, unplugging your internet is not the same thing as
timing out. Ironically (?) the browser behaves differently when you
unplug the internet, sometimes throwing exceptions instead of just
failing.
  

So it's a different thing if I unplug my internet manually to my 
server is not available, wow. And I have tried it, unplugged my server 
instead of my client and you are right. For now, this is absolutely 
sufficient for me.

I'm working on adding in the unplug the internet, have it fail
gracefully functionality. Hopefully it'll be in by 1.1.
  

So this would most of the times happen, if the user completely 
disconnect from internet on a dial-up connection and provoke ajax-calls 
then. It's also an issue, if you have a JQ-application that polls the 
server from time to time. Just to really understand what happens...

Arash

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-09 Thread John Resig
 So this would most of the times happen, if the user completely
 disconnect from internet on a dial-up connection and provoke ajax-calls
 then. It's also an issue, if you have a JQ-application that polls the
 server from time to time. Just to really understand what happens...

That's correct  - and that's why it's important to get it in (at some
point). It's definitely a frustrating issue to deal with -
essentially, you have to wrap the entire XMLHttpRequest in a try/catch
block looking for exceptions (of which no more internet is one).

--John

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-09 Thread Arash Yalpani
John Resig schrieb:

That's correct  - and that's why it's important to get it in (at some
point). It's definitely a frustrating issue to deal with -
essentially, you have to wrap the entire XMLHttpRequest in a try/catch
block looking for exceptions (of which no more internet is one).
  

John, thanks for the clarification!
Good night,
Arash

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-07 Thread Arash Yalpani
Hello Jörn,

Check out http://www.visualjquery.com/
It has a category for AJAX.
  


thank you, I did. The $.ajax* ones are missing there too.
Good night,
Arash

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-07 Thread Arash Yalpani

Yep - this is using the same data that's on /api/ so it also doesn't
have the aforementioned methods. I'm working to document them, sorry
for the delay.
  

Ah, take your time! But could you please announce it on the list or the 
JQuery blog whenever you are done with that? It's my last step of 
complete migration to JQuery :)
Arash

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-07 Thread John Resig
 Ah, take your time! But could you please announce it on the list or the
 JQuery blog whenever you are done with that? It's my last step of
 complete migration to JQuery :)

Sure thing, I've been lagging behind on my jQuery updates because I
had to put off some of my book deadlines in order to get 1.0 out. I'll
be sure to announce when the docs are fully complete.

--John

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Understanding $.ajaxTimeout

2006-09-07 Thread Michael Fuerst
On Fri, September 8, 2006 0:13, Jörn Zaefferer said:

 Check out http://www.visualjquery.com/
 It has a category for AJAX.

Is it only me, or is the complete post part missing in the ajax sektion?

michael


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/