Bug Tracker

Ticket #12004 (closed feature: fixed)

Opened 2 years ago

Last modified 19 months ago

Allow ajax.method as alias for ajax.type

Reported by: david71rj Owned by: dmethvin
Priority: low Milestone: 1.9
Component: ajax Version: 1.8.2
Keywords: Cc:
Blocking: Blocked by:

Description

Suggestion to 1.9.

Can be better to rename the ajax.type to ajax.method? I generally read METHOD POST and not TYPE POST. ajax.dataType can be renamed to ajax.type, like TYPE SCRIPT, TYPE HTML, TYPE TEXT, ...

Change History

comment:1 Changed 2 years ago by rwaldron

While it's possible to add an alias, I doubt we'll be able to complete "rename" the property - it would break everything that used $.ajax

comment:2 Changed 2 years ago by dmethvin

  • Status changed from new to open

Agreed, I'd be good with an alias (and have expected it to be method in the past) but we can't just rename it.

comment:3 Changed 2 years ago by dmethvin

  • Component changed from unfiled to ajax

comment:4 Changed 23 months ago by dmethvin

  • Type changed from enhancement to feature

Bulk change from enhancement to feature.

comment:5 Changed 22 months ago by jaubourg

The good approach is to keep using type internally but accept and consider method in the first place in the main ajax function:

options.type = options.method || options.type;

That way we can keep type internally and not break existing prefilters and transports.

comment:6 Changed 22 months ago by timmywil

  • Priority changed from undecided to low
  • Status changed from open to closed
  • Resolution set to wontfix

It doesn't sound like this will get done.

comment:7 Changed 22 months ago by timmywil

  • Status changed from closed to reopened
  • Resolution wontfix deleted

Sorry, I'm +1 on aliasing type and method, just not switching type and dataType

comment:8 Changed 22 months ago by timmywil

  • Status changed from reopened to open
  • Version set to 1.8.2
  • Milestone changed from None to 1.9

comment:9 Changed 22 months ago by david71rj

Yeah, dataType is inviable just now, to not cause breaks.

comment:10 Changed 21 months ago by farmdawgnation

I've opened a pull request for this on Github.  https://github.com/jquery/jquery/pull/1007

comment:11 Changed 20 months ago by dmethvin

  • Owner set to dmethvin
  • Status changed from open to assigned

comment:12 Changed 20 months ago by Matt Farmer

  • Status changed from assigned to closed
  • Resolution set to fixed

Alias options.method to options.type. Fixes #12004.

Changeset: 081c4efcf7736433d2fb5702e7bd4f8616426af2

comment:13 Changed 19 months ago by dmethvin

  • Summary changed from Rename ajax.type to ajax.method to Allow ajax.method as alias for ajax.type
Note: See TracTickets for help on using tickets.