[jQuery] Re: $.ajax bug ?!? Maybe i've not understand somethings ....

2009-01-30 Thread Stefano Corallo


On 28 Gen, 17:03, Ricardo Tomasi ricardob...@gmail.com wrote:
 It isn't possible to have error/success callbacks for JSONP. You can't
 cancel the request either. Once you add a script tag to the head,
 the browser fires a GET request and it can't be interrupted - even if
 you remove the script before the response comes, the script will still
 run.


ok. got it!

 (the only event that fires on the script tag is 'onload', but it only
 tells you if the content has successfully loaded, not the opposite.
 There is no way to know if an error happened)

 Also, you're misunderstanding the way JSONP works - there is no need
 for a 'success' function, that is the callback function which will be
 called when the response is loaded. Thats 'jsonFlickerFeed' in my
 example.


Ok i've understood how jsonp work, but there's something that i can't
understand.
I try to explain better i can (sorry for my bad english)

1)Using the $.ajax method, an example:
$.ajax({
   type: methodType,
   url: theURL,
   data: params,
   dataType:jsonp,
   success: function(data){
console.log(onClick success);
   }
});

in the jquery core is built a temporary jsonp function to handle the
data returned by the server, if the succes function is defined the
temporary function call the succe function and pass the returned
data ... specifically at line 3314 of the jquery.1.3.1.js :

// Handle JSONP-style loading
window[ jsonp ] = function(tmp){
data = tmp;
success();
complete();
// Garbage collect
window[ jsonp ] = undefined;
try{ delete window[ jsonp ]; } catch(e){}
if ( head )
head.removeChild( script );
};

the tmp is the data returned by the server.

Now in your example you use the jsonFlickrFeed function but without
handling the returned data from the server:

jsonFlickrFeed = function(){ alert('flickr loaded'); };
$.jsonp({
  url: 'http://api.flickr.com/services/feeds/photos_public.gne?
tags=hackdayindialang=en-usformat=jsoncallback=jsonFlickrFeed',
  timeout: 10,
  onTimeout: function(url){ console.error('jsonp script timed out:
'+url) }
});

how to access the data returned from the server? How to modify the
$.jsonp function to call the success function defined and pass in the
data returned from the server ... this is sure possible case jquery in
$.ajax call do it, but i don't know how :-/

Many thanks, really!

I hope i've been clear, sorry for my english!


[jQuery] Re: $.ajax bug ?!? Maybe i've not understand somethings ....

2009-01-30 Thread Stefano Corallo


On 30 Gen, 19:25, Ricardo Tomasi ricardob...@gmail.com wrote:
 We can't access the success function of the $.ajax call without
 messing with jQuery source code, because the vars that name it are
 inside the jQuery function scope.


ok

 In JSONP, the JSON object is passed as an argument to the callback
 function. In the example I posted:

 jsonFlickrFeed = function(data){ //do something with data };


i've tried but data is always undefined,take a look:

http://jsbin.com/ajimu/edit

 On Jan 30, 7:28 am, Stefano Corallo stefan...@gmail.com wrote:

  On 28 Gen, 17:03, Ricardo Tomasi ricardob...@gmail.com wrote:

   It isn't possible to have error/success callbacks for JSONP. You can't
   cancel the request either. Once you add a script tag to the head,
   the browser fires a GET request and it can't be interrupted - even if
   you remove the script before the response comes, the script will still
   run.

  ok. got it!

   (the only event that fires on the script tag is 'onload', but it only
   tells you if the content has successfully loaded, not the opposite.
   There is no way to know if an error happened)

   Also, you're misunderstanding the way JSONP works - there is no need
   for a 'success' function, that is the callback function which will be
   called when the response is loaded. Thats 'jsonFlickerFeed' in my
   example.

  Ok i've understood how jsonp work, but there's something that i can't
  understand.
  I try to explain better i can (sorry for my bad english)

  1)Using the $.ajax method, an example:
  $.ajax({
                             type: methodType,
                             url: theURL,
                             data: params,
                             dataType:jsonp,
                             success: function(data){
                                          console.log(onClick success);
                                     }
                              });

  in the jquery core is built a temporary jsonp function to handle the
  data returned by the server, if the succes function is defined the
  temporary function call the succe function and pass the returned
  data ... specifically at line 3314 of the jquery.1.3.1.js :

  // Handle JSONP-style loading
                          window[ jsonp ] = function(tmp){
                                  data = tmp;
                                  success();
                                  complete();
                                  // Garbage collect
                                  window[ jsonp ] = undefined;
                                  try{ delete window[ jsonp ]; } catch(e){}
                                  if ( head )
                                          head.removeChild( script );
                          };

  the tmp is the data returned by the server.

  Now in your example you use the jsonFlickrFeed function but without
  handling the returned data from the server:

  jsonFlickrFeed = function(){ alert('flickr loaded'); };
  $.jsonp({
    url: 'http://api.flickr.com/services/feeds/photos_public.gne?
  tags=hackdayindialang=en-usformat=jsoncallback=jsonFlickrFeed',
    timeout: 10,
    onTimeout: function(url){ console.error('jsonp script timed out:
  '+url) }

  });

  how to access the data returned from the server? How to modify the
  $.jsonp function to call the success function defined and pass in the
  data returned from the server ... this is sure possible case jquery in
  $.ajax call do it, but i don't know how :-/

  Many thanks, really!

  I hope i've been clear, sorry for my english!


[jQuery] Re: $.ajax bug ?!? Maybe i've not understand somethings ....

2009-01-30 Thread Stefano Corallo

:) in effect i've investigated but i'm not a guru of js so i need some
help ... thanks.

last but not least :D can you explain this code:

self[callback] = window[callback];
  window[callback] = (function(callback){
return function(data){
   (window[callback] = self[callback])(data);
delete self[callback];
clearTimeout(timer);
   };
  })(callback);

On 30 Gen, 23:57, Ricardo Tomasi ricardob...@gmail.com wrote:
 Ah, an oversight of mine. I forgot to add the parameter when rewriting
 the callback.

 Fixed as you can see athttp://jsbin.com/eliwu

 Never use someone else's code without inspection ;)

 On Jan 30, 4:34 pm, Stefano Corallo stefan...@gmail.com wrote:

  On 30 Gen, 19:25, Ricardo Tomasi ricardob...@gmail.com wrote:

   We can't access the success function of the $.ajax call without
   messing with jQuery source code, because the vars that name it are
   inside the jQuery function scope.

  ok

   In JSONP, the JSON object is passed as an argument to the callback
   function. In the example I posted:

   jsonFlickrFeed = function(data){ //do something with data };

  i've tried but data is always undefined,take a look:

 http://jsbin.com/ajimu/edit

   On Jan 30, 7:28 am, Stefano Corallo stefan...@gmail.com wrote:

On 28 Gen, 17:03, Ricardo Tomasi ricardob...@gmail.com wrote:

 It isn't possible to have error/success callbacks for JSONP. You can't
 cancel the request either. Once you add a script tag to the head,
 the browser fires a GET request and it can't be interrupted - even if
 you remove the script before the response comes, the script will still
 run.

ok. got it!

 (the only event that fires on the script tag is 'onload', but it only
 tells you if the content has successfully loaded, not the opposite.
 There is no way to know if an error happened)

 Also, you're misunderstanding the way JSONP works - there is no need
 for a 'success' function, that is the callback function which will be
 called when the response is loaded. Thats 'jsonFlickerFeed' in my
 example.

Ok i've understood how jsonp work, but there's something that i can't
understand.
I try to explain better i can (sorry for my bad english)

1)Using the $.ajax method, an example:
$.ajax({
                           type: methodType,
                           url: theURL,
                           data: params,
                           dataType:jsonp,
                           success: function(data){
                                        console.log(onClick success);
                                   }
                            });

in the jquery core is built a temporary jsonp function to handle the
data returned by the server, if the succes function is defined the
temporary function call the succe function and pass the returned
data ... specifically at line 3314 of the jquery.1.3.1.js :

// Handle JSONP-style loading
                        window[ jsonp ] = function(tmp){
                                data = tmp;
                                success();
                                complete();
                                // Garbage collect
                                window[ jsonp ] = undefined;
                                try{ delete window[ jsonp ]; } 
catch(e){}
                                if ( head )
                                        head.removeChild( script );
                        };

the tmp is the data returned by the server.

Now in your example you use the jsonFlickrFeed function but without
handling the returned data from the server:

jsonFlickrFeed = function(){ alert('flickr loaded'); };
$.jsonp({
  url: 'http://api.flickr.com/services/feeds/photos_public.gne?
tags=hackdayindialang=en-usformat=jsoncallback=jsonFlickrFeed',
  timeout: 10,
  onTimeout: function(url){ console.error('jsonp script timed out:
'+url) }

});

how to access the data returned from the server? How to modify the
$.jsonp function to call the success function defined and pass in the
data returned from the server ... this is sure possible case jquery in
$.ajax call do it, but i don't know how :-/

Many thanks, really!

I hope i've been clear, sorry for my english!


[jQuery] Re: $.ajax bug ?!? Maybe i've not understand somethings ....

2009-01-28 Thread Stefano Corallo

thank's i'll give it a try ... stay tuned :D

On 27 Gen, 22:45, Ricardo Tomasi ricardob...@gmail.com wrote:
 Hi Stefano, I think I found a solution. All you need to do is check if
 the callback has been called after your specified timeout. If it has
 not been called yet, overwrite it with an empty function, else do
 nothing. That will mess up with any further usage of the callback, but
 it works for this case anyway, take a look:

 http://jsbin.com/ukehu/http://jsbin.com/ukehu/edit

 Change the timeout: 1 in the $.jsonp() call to a short/long value to
 test it. I made the callback and timeout callback Firebug logs also.

 cheers,
 - ricardo

 On Jan 27, 5:01 pm, Ricardo Tomasi ricardob...@gmail.com wrote:

  Unless you remove the script tag after the 'timeout', of couse.

  On Jan 27, 9:59 am, Mike Alsup mal...@gmail.com wrote:

ah  and there is no way to simulate that?

   You can simulate a timeout in your code by using setTimeout, but it's
   not the same as when the XHR is used for the request.  With XHR jQuery
   can invoke the abort fn to cancel the request.  There is no such
   option for the jsonp script injection method.  So you can not close
   the connection or do anything particularly useful other than assume
   your timeout is being called because the request failed.  But then
   you're only guessing, and the response may return the moment after you
   time it out.


[jQuery] Re: $.ajax bug ?!? Maybe i've not understand somethings ....

2009-01-28 Thread Stefano Corallo

Ok perfect :) Many thanks.

So if i've understand the request continue loading and when server
send back the response (if any) if the timeout as occured there is no
callback set on window and do nothing else do the job  have any
sense try to shutdown the request? Is possible?

Anyway thanks a lot.

On 28 Gen, 09:23, Stefano Corallo stefan...@gmail.com wrote:
 thank's i'll give it a try ... stay tuned :D

 On 27 Gen, 22:45, Ricardo Tomasi ricardob...@gmail.com wrote:

  Hi Stefano, I think I found a solution. All you need to do is check if
  the callback has been called after your specified timeout. If it has
  not been called yet, overwrite it with an empty function, else do
  nothing. That will mess up with any further usage of the callback, but
  it works for this case anyway, take a look:

 http://jsbin.com/ukehu/http://jsbin.com/ukehu/edit

  Change the timeout: 1 in the $.jsonp() call to a short/long value to
  test it. I made the callback and timeout callback Firebug logs also.

  cheers,
  - ricardo

  On Jan 27, 5:01 pm, Ricardo Tomasi ricardob...@gmail.com wrote:

   Unless you remove the script tag after the 'timeout', of couse.

   On Jan 27, 9:59 am, Mike Alsup mal...@gmail.com wrote:

 ah  and there is no way to simulate that?

You can simulate a timeout in your code by using setTimeout, but it's
not the same as when the XHR is used for the request.  With XHR jQuery
can invoke the abort fn to cancel the request.  There is no such
option for the jsonp script injection method.  So you can not close
the connection or do anything particularly useful other than assume
your timeout is being called because the request failed.  But then
you're only guessing, and the response may return the moment after you
time it out.


[jQuery] Re: $.ajax bug ?!? Maybe i've not understand somethings ....

2009-01-28 Thread Stefano Corallo

Hi Riccardo,

i've a problem in the example you posted you do:

$.jsonp({
  url: 'http://api.flickr.com/services/feeds/photos_public.gne?
tags=hackdayindialang=en-usformat=jsoncallback=jsonFlickrFeed',
  timeout: 1,
  onTimeout: function(url){ console.error('jsonp script timed out:
'+url) }
});

how about the success function? and the error one etc etc ?!?!

I'm tring to something like this :

.jsonp({
   type: GET,
   url: some.php,
   data: name=Johnlocation=Boston,
   timeout: 1, // in seconds
   success: function(msg){
 alert( Data Saved:  + msg );
   },
   error:function(request, errorType, errorThrown){
  alert(oppps  );
   },
   onTimeout:function(url){ console.error('jsonp script timed out:
'+url) }
 });

the success function is never executed (timeout or not).
In your example you've defined a function before the $.jsonp call (the
jsonFlickrFeed) and added in the url of the request ... why the
success function is not working? I've forgotten something?

Thanks.

On 28 Gen, 10:15, Stefano Corallo stefan...@gmail.com wrote:
 Ok perfect :) Many thanks.

 So if i've understand the request continue loading and when server
 send back the response (if any) if the timeout as occured there is no
 callback set on window and do nothing else do the job  have any
 sense try to shutdown the request? Is possible?

 Anyway thanks a lot.

 On 28 Gen, 09:23, Stefano Corallo stefan...@gmail.com wrote:

  thank's i'll give it a try ... stay tuned :D

  On 27 Gen, 22:45, Ricardo Tomasi ricardob...@gmail.com wrote:

   Hi Stefano, I think I found a solution. All you need to do is check if
   the callback has been called after your specified timeout. If it has
   not been called yet, overwrite it with an empty function, else do
   nothing. That will mess up with any further usage of the callback, but
   it works for this case anyway, take a look:

  http://jsbin.com/ukehu/http://jsbin.com/ukehu/edit

   Change the timeout: 1 in the $.jsonp() call to a short/long value to
   test it. I made the callback and timeout callback Firebug logs also.

   cheers,
   - ricardo

   On Jan 27, 5:01 pm, Ricardo Tomasi ricardob...@gmail.com wrote:

Unless you remove the script tag after the 'timeout', of couse.

On Jan 27, 9:59 am, Mike Alsup mal...@gmail.com wrote:

  ah  and there is no way to simulate that?

 You can simulate a timeout in your code by using setTimeout, but it's
 not the same as when the XHR is used for the request.  With XHR jQuery
 can invoke the abort fn to cancel the request.  There is no such
 option for the jsonp script injection method.  So you can not close
 the connection or do anything particularly useful other than assume
 your timeout is being called because the request failed.  But then
 you're only guessing, and the response may return the moment after you
 time it out.


[jQuery] $.ajax bug ?!? Maybe i've not understand somethings ....

2009-01-27 Thread Stefano Corallo

Hi all,

with refer at this previous post
http://groups.google.it/group/jquery-en/browse_thread/thread/48725e45d59f1481?hl=it
i've investigate and debugging version 1.3.1 of jquery i've notice
that in the ajax function (line 3278):




// If we're requesting a remote document
// and trying to load JSON or Script with a GET
console.log(critical test ... s:%o type:%o 
parts:%o,s,type,parts);
if ( s.dataType == script  type == GET  parts
 ( parts[1]  parts[1] != location.protocol || 
parts[2] !=
location.host )){

var head = document.getElementsByTagName(head)[0];
var script = document.createElement(script);
script.src = s.url;
if (s.scriptCharset)
script.charset = s.scriptCharset;

// Handle Script loading
console.log(handle script loading...);
console.log(testing jsonp [%o]  ...,jsonp);
console.log(!jsonp -- %o,(!jsonp));
if ( !jsonp ) {
console.log(dentro if(!jsonp) ...);
var done = false;

// Attach handlers for all browsers
console.log(attaching handlers for all 
browsers);
script.onload = script.onreadystatechange = 
function(){
if ( !done  (!this.readyState ||
this.readyState == 
loaded || this.readyState == complete) )
{
done = true;
success();
complete();
head.removeChild( script );
}
};
}

head.appendChild(script);

// We handle everything using the script element 
injection
return undefined;
}
.
.

so if i'm doing a cross domain request at url domain:port/some.php the
conditional test above

   if ( !jsonp ) {

is not executed because jsonp is defined ... and the execution
continue with:

 head.appendChild(script);

// We handle everything using the script element 
injection
return undefined;

In this case the execution stop because the return statement and there
is no way to setup the onreadystatefunction and other stuff coded down
after the statement

if ( s.dataType == script  type == GET  parts
 ( parts[1]  parts[1] != location.protocol || 
parts[2] !=
location.host )){

This in my case generate a non correct handling of the timeout lookup
but maybe there are other problem i'm not able to see.


Thank's for help and clarifications.


[jQuery] Re: $.ajax timeout and trouble with Microsoft IIS 6

2009-01-27 Thread Stefano Corallo

maybe an $.ajax bug like explained in :
http://groups.google.it/group/jquery-en/t/b75f222ac0a68bb2?hl=it

On 23 Gen, 09:48, Stefano Corallo stefan...@gmail.com wrote:
 the cache:false option not work. :(

 On 22 Gen, 20:10, jay jay.ab...@gmail.com wrote:

  Perhaps the cache:false option is necessary? It adds a timestamp to
  the end of the querystring.  The browser may be caching the request
  and therefore not showing potential errors.  But then that wouldn't
  explain the descrepency between apache and iis.

  On Jan 22, 11:55 am, Stefano Corallo stefan...@gmail.com wrote:

   Hi all,

   i've a client side scrit that do a request to a server the server
   sleep for a 10 seconds and the respond, in the client side script i
   setup the timeout option at 1 second (1000) and i want to catch the
   error thrown (like explained all around the web :) )

   a bit of code explain better:

   //client side
   $.ajax({
      type: GET,
      url: some.php,
      data: name=Johnlocation=Boston,
      timeout: 1000
      success: function(msg){
        alert( Data Saved:  + msg );
      },
      error:function(request, errorType, errorThrown){
         alert(oppps  );
      }
    });

   //backend some.php
   ?
    //simulate long task
   sleep(10); //sleep 10 seconds

   //send response
   echo some test data;
   ?

   Now the problem is that under apache all work good and i can see the
   alert message opp, but under the iis 6 no alert message popup and
   after 10 seconds the some test data came back to the client ...

   Have any one experience a problem like this? There something to set in
   iis ?

   Any help appreciated :D

   ps: sorry for my bad english :(


[jQuery] Re: $.ajax bug ?!? Maybe i've not understand somethings ....

2009-01-27 Thread Stefano Corallo

yes ok but i've set the jsonp option to avoid this problem like
explained in

http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/

that i've found http://docs.jquery.com/Ajax/jQuery.ajax#options

i'm wrong?


On 27 Gen, 12:06, Mike Alsup mal...@gmail.com wrote:
  In this case the execution stop because the return statement and there
  is no way to setup the onreadystatefunction and other stuff coded down
  after the statement

  if ( s.dataType == script  type == GET  parts
                           ( parts[1]  parts[1] != location.protocol || 
  parts[2] !=
  location.host )){

  This in my case generate a non correct handling of the timeout lookup
  but maybe there are other problem i'm not able to see.

  Thank's for help and clarifications.

 This is because ajax can not be used x-domain due to browser security.

 http://docs.jquery.com/Ajax/jQuery.ajax#options


[jQuery] Re: $.ajax bug ?!? Maybe i've not understand somethings ....

2009-01-27 Thread Stefano Corallo

With the jsonp option i'm able to do cross domain request but i can't
control the timeout and i'm wondering about why?

On 27 Gen, 12:22, Stefano Corallo stefan...@gmail.com wrote:
 yes ok but i've set the jsonp option to avoid this problem like
 explained in

 http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/

 that i've foundhttp://docs.jquery.com/Ajax/jQuery.ajax#options

 i'm wrong?

 On 27 Gen, 12:06, Mike Alsup mal...@gmail.com wrote:

   In this case the execution stop because the return statement and there
   is no way to setup the onreadystatefunction and other stuff coded down
   after the statement

   if ( s.dataType == script  type == GET  parts
                            ( parts[1]  parts[1] != location.protocol || 
   parts[2] !=
   location.host )){

   This in my case generate a non correct handling of the timeout lookup
   but maybe there are other problem i'm not able to see.

   Thank's for help and clarifications.

  This is because ajax can not be used x-domain due to browser security.

 http://docs.jquery.com/Ajax/jQuery.ajax#options


[jQuery] Re: $.ajax bug ?!? Maybe i've not understand somethings ....

2009-01-27 Thread Stefano Corallo

ah  and there is no way to simulate that?

i want close the connection with the server if the request take a
long time, and do something default like a message or other stuff ...
what can i do?

On 27 Gen, 12:30, Mike Alsup mal...@gmail.com wrote:
  With the jsonp option i'm able to do cross domain request but i can't
  control the timeout and i'm wondering about why?

  On 27 Gen, 12:22, Stefano Corallo stefan...@gmail.com wrote:

   yes ok but i've set the jsonp option to avoid this problem like
   explained in

  http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/

   that i've foundhttp://docs.jquery.com/Ajax/jQuery.ajax#options

 This is because ajax is not being used.  There are no readystatechange
 callbacks and there is no way to cancel an outstanding jsonp request.
 In other words, there is no way to reliably implement timeout.


[jQuery] Re: $.ajax timeout and trouble with Microsoft IIS 6

2009-01-23 Thread Stefano Corallo

the cache:false option not work. :(

On 22 Gen, 20:10, jay jay.ab...@gmail.com wrote:
 Perhaps the cache:false option is necessary? It adds a timestamp to
 the end of the querystring.  The browser may be caching the request
 and therefore not showing potential errors.  But then that wouldn't
 explain the descrepency between apache and iis.

 On Jan 22, 11:55 am, Stefano Corallo stefan...@gmail.com wrote:

  Hi all,

  i've a client side scrit that do a request to a server the server
  sleep for a 10 seconds and the respond, in the client side script i
  setup the timeout option at 1 second (1000) and i want to catch the
  error thrown (like explained all around the web :) )

  a bit of code explain better:

  //client side
  $.ajax({
     type: GET,
     url: some.php,
     data: name=Johnlocation=Boston,
     timeout: 1000
     success: function(msg){
       alert( Data Saved:  + msg );
     },
     error:function(request, errorType, errorThrown){
        alert(oppps  );
     }
   });

  //backend some.php
  ?
   //simulate long task
  sleep(10); //sleep 10 seconds

  //send response
  echo some test data;
  ?

  Now the problem is that under apache all work good and i can see the
  alert message opp, but under the iis 6 no alert message popup and
  after 10 seconds the some test data came back to the client ...

  Have any one experience a problem like this? There something to set in
  iis ?

  Any help appreciated :D

  ps: sorry for my bad english :(


[jQuery] $.ajax timeout and trouble with Microsoft IIS 6

2009-01-22 Thread Stefano Corallo

Hi all,

i've a client side scrit that do a request to a server the server
sleep for a 10 seconds and the respond, in the client side script i
setup the timeout option at 1 second (1000) and i want to catch the
error thrown (like explained all around the web :) )

a bit of code explain better:

//client side
$.ajax({
   type: GET,
   url: some.php,
   data: name=Johnlocation=Boston,
   timeout: 1000
   success: function(msg){
 alert( Data Saved:  + msg );
   },
   error:function(request, errorType, errorThrown){
  alert(oppps  );
   }
 });

//backend some.php
?
 //simulate long task
sleep(10); //sleep 10 seconds

//send response
echo some test data;
?


Now the problem is that under apache all work good and i can see the
alert message opp, but under the iis 6 no alert message popup and
after 10 seconds the some test data came back to the client ...

Have any one experience a problem like this? There something to set in
iis ?

Any help appreciated :D

ps: sorry for my bad english :(


[jQuery] Re: $.ajax timeout and trouble with Microsoft IIS 6

2009-01-22 Thread Stefano Corallo

mmm i don't know ... i'll give it a try and let you know...any other
idea?
It seems that the connection is not closed but the server keep it
alive.
If i'm not wrong when a timeout occurs the client close the connection
right?
In the apache way it work and i can see that (thanks firebug), but
with the IIS i can see that the request wait for 10 second and then
the response come from the server ... the client is unable to
disconnect or maybe something as to be set in the configuration of the
server (i don't think so really but is possible) ?

On 22 Gen, 20:10, jay jay.ab...@gmail.com wrote:
 Perhaps the cache:false option is necessary? It adds a timestamp to
 the end of the querystring.  The browser may be caching the request
 and therefore not showing potential errors.  But then that wouldn't
 explain the descrepency between apache and iis.

 On Jan 22, 11:55 am, Stefano Corallo stefan...@gmail.com wrote:

  Hi all,

  i've a client side scrit that do a request to a server the server
  sleep for a 10 seconds and the respond, in the client side script i
  setup the timeout option at 1 second (1000) and i want to catch the
  error thrown (like explained all around the web :) )

  a bit of code explain better:

  //client side
  $.ajax({
     type: GET,
     url: some.php,
     data: name=Johnlocation=Boston,
     timeout: 1000
     success: function(msg){
       alert( Data Saved:  + msg );
     },
     error:function(request, errorType, errorThrown){
        alert(oppps  );
     }
   });

  //backend some.php
  ?
   //simulate long task
  sleep(10); //sleep 10 seconds

  //send response
  echo some test data;
  ?

  Now the problem is that under apache all work good and i can see the
  alert message opp, but under the iis 6 no alert message popup and
  after 10 seconds the some test data came back to the client ...

  Have any one experience a problem like this? There something to set in
  iis ?

  Any help appreciated :D

  ps: sorry for my bad english :(