Skip to main content

Bug Tracker

Side navigation

#3155 closed bug (invalid)

Opened July 13, 2008 07:24PM UTC

Closed January 08, 2009 04:23AM UTC

Request method GET in Internet Explorer 6 & 7

Reported by: jzajpt Owned by:
Priority: major Milestone: 1.3
Component: ajax Version: 1.2.6
Keywords: ie7, ajax, get, post Cc:
Blocked by: Blocking:
Description

When using Internet Explorer 6 & 7, simple code below uses POST method instead of GET (and for example in Rails causes invocation of wrong action when being RESTful):

$.get("example", function(data){
  alert(data);
});

Also, following examples use POST too instead of GET.

$.ajax({
  url: "example",
  type: "GET",
  success: function(html){
   alert(html);
  }
});
$("#example").load("example");
Attachments (0)
Change History (3)

Changed July 13, 2008 07:30PM UTC by jzajpt comment:1

Forgot one thing, the error is happening only when following code is present:

$(document).ajaxSend(function(event, request, settings) {
 if (typeof(AUTH_TOKEN) == "undefined") return;
   settings.data = settings.data || "";
   settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN);
});

Replying to [ticket:3155 jzajpt]:

When using Internet Explorer 6 & 7, simple code below uses POST method instead of GET (and for example in Rails causes invocation of wrong action when being RESTful):
> $.get("example", function(data){
>   alert(data);
> });
> 
Also, following examples use POST too instead of GET.
> $.ajax({
>   url: "example",
>   type: "GET",
>   success: function(html){
>    alert(html);
>   }
> });
> 
> $("#example").load("example");
> 

Changed October 20, 2008 02:26AM UTC by dmethvin comment:2

If the request includes *any* data, IE will assume POST. The $.ajax() code takes care of this for GET requests by appending settings.data to settings.url and clearing settings.data, but the global ajax events are triggered after that fix has been applied. So, on a GET request you must add to settings.url, not settings.data.

Changed January 08, 2009 04:23AM UTC by dmethvin comment:3

resolution: → invalid
status: newclosed