What happens when no response is received for a request? I'm seeing retries What happens when no response is received for a request? I'm seeing retries ajax ajax

What happens when no response is received for a request? I'm seeing retries


Checkout this blog post that explains what is happening:http://geek.starbean.net/?p=393

According to HTTP/1.1 RFC 8.2.4:

If an HTTP/1.1 client sends a request which includes a request body, but which does not include an Expect request-header field with the “100-continue” expectation, and if the client is not directly connected to an HTTP/1.1 origin server, and if the client sees the connection close before receiving any status from the server, the client SHOULD retry the request.

Make sure you design your web app to tolerate these extra requests. And if you want the ajax request to do something only once, such as writing something to a database, then you need to design the request as idempotent. See: What is an idempotent operation?

Also, this highlights the differences between GET and POST operations:http://www.cs.tut.fi/~jkorpela/forms/methods.html

As a general design practice:
-GET operations should be designed as idempotent
-POST operations should be used for writing to databases, etc.


Why are you setting a callback if your request is not async?

If you want a sync process put beforeSend code before the call and the success callback simply after the call.

If you want an async approach then set async: true

Also this line of code is wrong:

url: '<%= url_for('importDevice') %>',

Look at the quotes: should be

url: '<%= url_for("importDevice") %>',

Maybe those suggestions won't solve the problem but will point you in the right direction. The problem may be somewhere else than in the code posted...

Going back to your question:Could it be the browser? I don't think but who knows what's out there!!... what's the browser? Have you tried with another one?

I'd suggest trying with Firefox and using the Live httpHeaders plugin (very easy to setup and use). You'll see what's going out from the client side, intead of see what's coming in from the server side.