views:

1315

answers:

2

Hi All, i'have a js client with JQuery, this js call a page (GET HTTP) and set timeout. The aim of timeout is: "do something if the server not responds". If i use Apache web server for manage a page, the timeout perform. If i use IIS 6.0 the timeout is "skipped" and the page attempt (anyway) the server response. This is the script:

//client side

$.ajax({
    type: "GET",
    url: "some.php",
    data: "name=John&location=Boston",
    timeout: 5000
    success: function(msg){
        alert( "Data Saved: " + msg );
    },
    error: function(request, errorType, errorThrown){
        alert("opppsssss .... ");
    }
});

I suppose that is a IIS..is it right? or i made a mistake in JQuery code?

best regerds

Domenico

+1  A: 

As Paolo mentioned in a comment, you're missing a comma after the timeout declaration. I very recently had a situation where a missing comma in an object declaration like that would cause IE to choke on the script and not run it properly (while firefox had no problems running it).

That wouldn't explain why the different servers would be causing different behavior, but it would probably be worth fixing that first and retesting, as the behavior might change and might be easier to debug.

Herms
I'll second this -- I've seen several times that firefox generously interprets javascript objects declared in that manner where IE will choke on the missing comma. Whether or not this is causing the problem he's worried about, it IS a problem.
Clyde
A: 

Hi Guys,

Thank you for response, i complete the question :)

The server code is:

//backend some.php

< ?

//simulate long task

sleep(10); //sleep 10 seconds

//send response

echo "some test data";

? >

Sorry, the comma error is a my cut&paste error..

The problem this is when timeout is over, the error dialog not appear because the connection from server isn't interrupted by timeout, so the server (slowly) however responds.

Have you idea because the server connection isn't interrupt?

Domenico
For future reference, it's preferred that you edit your question to add details, not post an answer with the extra details. It clutters the answers a bit.
Herms