JQuery 1.5 sends only GET requests in ajax method

I am trying to make a PUT request to a RESTful web service, however, it seems like jQuery 1.5 is responding to any changes to the type setting. The request is sent as GET regardless of the value in 'type'. In jQuery 1.4, this is not a problem.

Here is my code:

$.ajax({
    type: "PUT",
    url: "https://api.somesite.com/v1.0/people/" + individualID + "/",
    dataType: "jsonp",
    data: $("#editProfile").serializeArray(),
    cache: "false",
    success: function(data,textStatus,jqXHR) {
        $.modal.close();
    },
    error: function(jqXHR,textStatus,errorThrown) {
        alert("Error!");
    }
});
+5
source share
4 answers

As far as I know, you cannot make a JSONP request through PUT. Since JSONP works by entering an element <script>pointing to the remote domain, this request will always be a GET request.

PUT , - , CORS, IE.

+6

jQuery.ajax() docs:

( "POST" "GET" ), "GET". : HTTP-, PUT DELETE, , .

, , , , jQuery , GET POST. , =)

0

Rails JQuery, ?

edit: oups, , - Rails. . POST?

0

- . PUT 1.5, 1.5. , , ajax 1.5, . , , firefox chrome. , OPTIONS , , , OPTIONS a la CORS. , 1.5, . firefox OPTIONS. .

http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" 

var url = 'http://api.example.com/rest/action?key=123ABC&data={"value":55}';
$.ajax({
  type: "PUT",
  url: url,
  data: {},
  success: function(msg){
    alert( "Data Saved: " + msg );
  },
  error: function(msg){
     console.debug(msg);
  }
});
0
source

All Articles