Skip to main content

Bug Tracker

Side navigation

#4373 closed bug (worksforme)

Opened March 18, 2009 10:32AM UTC

Closed March 19, 2009 02:39PM UTC

Last modified March 14, 2012 02:30PM UTC

first ajax request is sent multiple times

Reported by: fmp Owned by:
Priority: major Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

Afte a page is loaded the first ajax request is sent multiple times (I observed 2 - 7 times). Additional requests (without page reload) have no problem.

browsers: FF, epiphany (linux); IE7 (windows)

Code example:

<script src="http://code.jquery.com/jquery-latest.js"></script>
<button onclick="$.post('save_defaults','')">Send</button>

Same problem with $.get $.ajax and $.post .

Could be a timing problem: In the same environment a simple page like the example above sends 2 requests, a bigger page sends 7 requests. In a different environment the simple page sends 4 requests.

Attachments (0)
Change History (7)

Changed March 18, 2009 01:56PM UTC by brandon comment:1

description: Afte a page is loaded the first ajax request is sent multiple times (I observed 2 - 7 times). Additional requests (without page reload) have no problem. \ \ browsers: FF, epiphany (linux); IE7 (windows) \ \ Code example: \ <script src="http://code.jquery.com/jquery-latest.js"></script> \ <button onclick="$.post('save_defaults','')">Send</button> \ \ Same problem with $.get $.ajax and $.post . \ \ Could be a timing problem: In the same environment a simple page like the example above sends 2 requests, a bigger page sends 7 requests. In a different environment the simple page sends 4 requests. \ Afte a page is loaded the first ajax request is sent multiple times (I observed 2 - 7 times). Additional requests (without page reload) have no problem. \ \ browsers: FF, epiphany (linux); IE7 (windows) \ \ Code example: \ {{{ \ <script src="http://code.jquery.com/jquery-latest.js"></script> \ <button onclick="$.post('save_defaults','')">Send</button> \ }}} \ Same problem with $.get $.ajax and $.post . \ \ Could be a timing problem: In the same environment a simple page like the example above sends 2 requests, a bigger page sends 7 requests. In a different environment the simple page sends 4 requests. \
resolution: → worksforme
status: newclosed

I can't reproduce the issue you are talking about. Try to create a simplified test case to isolate the issue. Feel free to reopen with a test case.

Changed March 18, 2009 02:30PM UTC by fmp comment:2

resolution: worksforme
status: closedreopened

As test case you can use the example code.

When you click the button multiple post requests are sent to the server.

You have to look at the server access logs to observer the problem or tcpdump the network connection.

You cannot see the problem in the webbrowser, as a callback function is fired only once.

The problem is critical as a server side script could do multiple inserts into a database.

Changed March 18, 2009 03:15PM UTC by brandon comment:3

resolution: → worksforme
status: reopenedclosed

The sample code you provided has a syntax error and after fixing that I'm not able to reproduce the error with this code. Please provide a more complete example that illustrates the issue.

Changed March 18, 2009 07:00PM UTC by fmp comment:4

resolution: worksforme
status: closedreopened

I have set up an example at http://137.208.226.25:9876/test.html

It has a "Send" button which does onclick="$.post('/aaa','')" .

In the page there is also a link to a second page ("logtail") which shows the last 20 log lines.

With this example I always get 2 identical loglines if I load the page and press the button (tested with FF, epiphany and IE7).

I also get 2 lines if I open a second browser window from the same browser instance (two FF or two IE windows on the same computer) and switch between these windows: If I open test.html, click Send, then open the logtail in a second window and again click

Send in the first window, 2 lines are logged.

If the logtail is opened in a different browser only one line is logged with everey further click.

Now it gets crazy: if I load a different page from the same site in an additional browser window (http://137.208.226.25:9876 and reload this page) and click Sende, I get 3 to 7 loglines (3 with IE, 4-5 with FF, 7 with epiphany) with the first click.

With tcpdump I can also see multiple requests from my browser, therefore it should not be a server problem.

Changed March 18, 2009 07:42PM UTC by brandon comment:5

I see the behavior you are experiencing on your server but using my local apache server and my server at media temple I'm unable to reproduce this issue.

Could you try to reproduce this on another server?

Changed March 19, 2009 08:51AM UTC by fmp comment:6

Solved: The problem only exists if the server does not answer the ajax request. If is sends a reply, no further request is sent.

Thanks for your help!!!

Changed March 19, 2009 02:39PM UTC by brandon comment:7

resolution: → worksforme
status: reopenedclosed