Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chrome sending an extra "GET" with a "POST" preventing an Ajax conversation?

 
marten kay
Ranch Hand
Posts: 188
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

My web app, following an initial authenticated GET request, responds with the following HTML response


The ready function sends a POST request to commence an ajax conversion.

This all works fine in Opera, FireFox,IE9, however Chrome keeps sending back an extra GET request after the initial (and all subsequent) POST requests. This extra GET totally breaks the conversation (and causes the page to reset in my case)

I have checked the GET headers and they are the same for both legitimate GET and the extra GETs, so I can't filter using headers (see below)

Headers


I have googled but it does not seem to be a common problem.

Any ideas?

Thanks

Marten
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the URL of the extra GET? And your code would be a lot easier to grok if it were indented!
 
marten kay
Ranch Hand
Posts: 188
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

They are the same for both the intial and the extra one

first get URL:http://localhost:85/TulipTest/edu
first get URI:/TulipTest/edu
extra get URL:http://localhost:85/TulipTest/edu
extra get URI:/TulipTest/edu

I can't figure it out, I have played around with the JQuery as well, ie changing to an $.ajax(). but same result.

I'll try and indent the code

Cheers
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Copied your code and didn't see the problem:

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is /edu returning? Is it more script that could possibly be causing a reload?
 
marten kay
Ranch Hand
Posts: 188
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found the problem after much searching. The HTML sent to the browser by the app includes the following code

(fixed - see comment below)

Note: the offending code is the src="" in the code block.

The img with an emply src attribute is contained within a div that is hidden. The div is made visible and the image tag replaced upon a user click.

So the problem was that Chrome continues to look for an image from the server.

.... when I finally found the offending code I found an existing comment about Chrome. Initially I had programmed for the src attribute to be set dynamically but Chrome would not re render a new image. Instead I needed to use JQuery to replace the whole tag and generate a new id... anyway I go on.

I was not expecting this to be the problem.

Thanks fo you help! I would not have been able to find the problem without the Developer Tool clue, which looks pretty cool.


Marten


FYI - /edu is the url for my controller servlet, there is only one servlet for doing stuff (except for login, error, welcom, upload and download)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
marten kay wrote:
Note: a src="" does not show up in the code block.

Click the "disable HTML" checkbox when posting HTML.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic