Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery ajax GET request executing twice
    primarykey
    data
    text
    <p>I have the following ajax request that is executed at a click of a button:</p> <pre><code>&lt;a href="javascript:test()"&gt;&lt;img src="css/images/test.png"&gt;&lt;/a&gt; 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 }); } </code></pre> <p>The request response takes approximately 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.</p> <p>This problem has been reproduced in a Samsung Galaxy S2, android version 2.3.5 in a phonegap application.</p> <p><strong>UPDATE - adding Apache log entries from comment below</strong></p> <pre><code>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" </code></pre> <p><strong>UPDATE - adb logcat</strong></p> <pre><code>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 </code></pre> <p><strong>UPDATE - TCP/IP monitor</strong></p> <p>Putting the requests through a TCP/IP monitor shows both requests being sent with a 200 response for both.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload