Bug Tracker

Modify

Ticket #3603 (closed feature: invalid)

Opened 5 years ago

Last modified 5 years ago

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
Blocking: Blocked by:

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

comment:1 Changed 5 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 5 years ago by flesler

  • Status changed from new to closed
  • Cc ricardoe added
  • Resolution set to invalid
  • Priority changed from major to minor
  • need changed from Patch to Review
  • Type changed from bug to feature

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.