javascriptjqueryajaxpostmethods

What is the Diff between type and method in ajax


HI i have used both the things in my experience i was thinking method and type both are POST and GET methods.

But seems like they are not similar.?

if i use type it is working i am serializeing a form data..

if i write method it is not working can can anyone explain what is the diff between them..?

$.ajax({
  url: "controller.php",
  type: 'POST',
  method: "POST",
  dataType: "json",
});

help is appropriated.


Solution

  • type (default: 'GET')
    Type: String
    An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0.

    http://api.jquery.com/jquery.ajax/