Side navigation
#13661 closed bug (notabug)
Opened March 25, 2013 11:14AM UTC
Closed March 25, 2013 02:08PM UTC
jquery ajax GET request executing twice
Reported by: | gmh04 | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I have the following ajax request that is executed at a click of a button:
<a href="javascript:test()"><img src="css/images/test.png"></a>
function test(){
console.debug("*");
$.ajax({
type: "GET",
dataType: "json",
url: '/path/to/url',
success: function(data){
console.debug("**");
},
error: function(jqXHR, status, error){
console.debug("*** " + status + " : " + error + " : " + jqXHR.status);
},
cache: false
});
}
The request response takes more 30 seconds to return. However, the request is received and executed by the server twice as can be seen by the apache logs. The timestamp of the requests are 30 seconds apart but the request is identical (e.g ?_=1363692320782). The click response function is called once and the error callback is invoked once (exactly 60 seconds after initial request), although the apache response is a 200.
This problem has been reproduced on a Samsung Galaxy S2:
android version 2.3.5
phonegap 2.1.0
jquery 1.8.1
JQM 1.2.0.
Apache log:
1.2.3.4 - - [19/Mar/2013:14:07:59 +0000] "GET /pcapi/records/dropbox/08342hjg9gpqm7g/?_=1363702072225 HTTP/1.1" 200 11139 "-" "Mozilla/5.0 (Linux; U; Android 2.3.5; en-gb; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
1.2.3.4 - - [19/Mar/2013:14:08:29 +0000] "GET /pcapi/records/dropbox/08342hjg9gpqm7g/?_=1363702072225 HTTP/1.1" 200 11139 "-" "Mozilla/5.0 (Linux; U; Android 2.3.5; en-gb; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
adb logcat:
I/Web Console(16747): * at file:///android_asset/www/js/mobile.js:1769
I/Web Console(16747): *** error : : 0 at file:///android_asset/www/js/mobile.js:1779
TCP/IP monitor
Putting the requests through a TCP/IP monitor shows both requests being sent with a 200 response for both.
Example Headers
First:
GET /pcapi/records/dropbox/08342hjg9gpqm7g/?_=1363703094238 HTTP/1.1
Host: devel.edina.ac.uk:3333
Connection: keep-alive
Accept-Encoding: gzip
Accept-Language: en-GB, en-US
x-wap-profile: http://wap.samsungmobile.com/uaprof/GT-I9100.xml
User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.5; en-gb; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Accept: application/json, text/javascript, */*; q=0.01
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
HTTP/1.1 200 OK
Date: Tue, 19 Mar 2013 14:25:01 GMT
Server: Apache/2.2.21 (Unix) mod_wsgi/3.3 Python/2.6.2
Content-Length: 11139
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/json
Second:
GET /pcapi/records/dropbox/08342hjg9gpqm7g/?_=1363703094238 HTTP/1.1
Host: devel.edina.ac.uk:3333
Connection: keep-alive
Accept-Encoding: gzip
Accept-Language: en-GB, en-US
x-wap-profile: http://wap.samsungmobile.com/uaprof/GT-I9100.xml
User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.5; en-gb; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Accept: application/json, text/javascript, */*; q=0.01
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
HTTP/1.1 200 OK
Date: Tue, 19 Mar 2013 14:25:31 GMT
Server: Apache/2.2.21 (Unix) mod_wsgi/3.3 Python/2.6.2
Content-Length: 11139
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/json
see http://stackoverflow.com/questions/15499647/jquery-ajax-get-request-executing-twice for more details of whats been tried.
Attachments (0)
Change History (3)
Changed March 25, 2013 11:20AM UTC by comment:1
Changed March 25, 2013 02:05PM UTC by comment:2
I've reproduced this problem with an XMLHttpRequest request, proving that it is not a jquery problem. please close this issue.
Changed March 25, 2013 02:08PM UTC by comment:3
resolution: | → notabug |
---|---|
status: | new → closed |
How can I modify this entry? I'd like to remove machine name from headers.