Bug Tracker

Opened 10 years ago

Closed 10 years ago

#14211 closed bug (notabug)

jQuery.get() and jQuery.post() do not support "url data dataType" signature

Reported by: m4ttlunn Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

With jQuery.get() and jQuery.post(), I cannot use the signature;

    jQuery.get('/foo', {
        // data
    }, 'json');

... instead, I have to specify a success handler as well;

    jQuery.get('/foo', {
        // data
    }, jQuery.noop, 'json');

This is because the code makes allowances for missing "data" param, but not for missing "success".

The documentation however, says that "success" is optional.

Change History (1)

comment:1 Changed 10 years ago by dmethvin

Resolution: notabug
Status: newclosed

You could use a null for the callback instead, or use $.getJSON. We'll update the docs to make it clearer.

https://github.com/jquery/api.jquery.com/issues/351

Note: See TracTickets for help on using tickets.