Bug Tracker

Opened 11 years ago

Closed 11 years ago

#3603 closed feature (invalid)

JSONP callback with multiple parameters

Reported by: ricardoe Owned by:
Priority: minor Milestone: 1.3
Component: ajax Version: 1.2.6
Keywords: jsonp, parameters, callback Cc: ricardoe
Blocked by: Blocking:

Description

JSONP callbacks only allow one parameter, I've modified the jQuery 1.2.6 code so I can use any number of parametes with the success function.

For Rev. 5891

Lines 2827 - 2828: if ( s.success )

s.success( data, status );

Becomes: if ( s.success ) {

data = jQuery.makeArray(data); data.push(status); s.success.apply(this,data);

}

And line 2629 data = tmp;

Now is: data = arguments;

I hope this is revised and introduced, restrict the number of params you can send to a function is, IMHO not a good thing.

Sorry, this is my first bug report.

Change History (2)

comment:1 Changed 11 years ago by ricardoe

Sorry I screw the code.

Lines 2827 - 2828:

if ( s.success )
    s.success( data, status );

Becomes:

if ( s.success ) {
    data = jQuery.makeArray(data);
    data.push(status);
    s.success.apply(this,data);
}

And line 2629:

data = tmp;

Now is:

data = arguments; 

comment:2 Changed 11 years ago by flesler

Cc: ricardoe added
need: PatchReview
Priority: majorminor
Resolution: invalid
Status: newclosed
Type: bugfeature

Everyone uses JSONP with one single argument, $.ajax's success callback ALWAYS receives one argument.

I don't see any need to add this, you can simply pass an array of objects (or w/e) instead of just one element.

Note: See TracTickets for help on using tickets.