Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#814 closed bug (fixed)

Calling load(url, data) causes "fn.apply is not a function" error.

Reported by: tuupola@… Owned by:
Priority: major Milestone: 1.1
Component: ajax Version: 1.1
Keywords: Cc:
Blocked by: Blocking:

Description

Calling load(url, data) causes fn.apply is not a function with 1.1. Example code:

$(document).ready(function() {

    var data = {};
    data['a'] = '1';
    data['b'] = '2';
    $('#foo').load('http://www.appelsiini.net/~tuupola/jquery/bugs/lorem.php', data);

});

Live example at:

http://www.appelsiini.net/~tuupola/jquery/bugs/load-1.1.html

Change History (5)

comment:1 Changed 13 years ago by anonymous

there's currently a bug in jQuery 1.1 which 'causes no params to be passed if using post to load data via ajax.

a possible workaround would be to use get, rewriting the piece of code to this:

$('#foo').load('http://www.appelsiini.net/~tuupola/jquery/bugs/lorem.php?a=1&b=2');

or fixing jQuery, by searching this line in the load method (most likely line 1814 depending on your version) if ( jQuery.isFunction( params.constructor ) ) { and replace it with if ( jQuery.isFunction( params ) ) {

best regards

lukas

comment:2 Changed 13 years ago by malsup

Fixed. 1/16/2006.

comment:3 Changed 13 years ago by joern

Resolution: fixed
Status: newclosed

Fixed in revision 1093.

comment:4 Changed 13 years ago by jackbravo@…

Resolution: fixed
Status: closedreopened

I also had this problem and applied the solution of revision 1093. but still got some problems on some cases using the same function: $('#id').load('./mini_list.php', { what: what_str, id: id_str });

the line in question was: 2148: if ( a[j].constructor == Array )

and just like the solution of revision 1093 I changed that to if ( a[j] == Array ) and the problem was solved..... altough I don't know why =P

comment:5 Changed 13 years ago by john

Component: coreajax
Milestone: 1.1
Resolution: fixed
Status: reopenedclosed

Jack - what you found is actually some thing different - you were passing in an undefined value for either what_str or id_str, which was causing the error to occur. I just submitted a fix for this and it'll now just send that undefined value to server instead. (Fixed in rev 1136)

Note: See TracTickets for help on using tickets.