#814 closed bug (fixed)
Calling load(url, data) causes "fn.apply is not a function" error.
Reported by: | 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 16 years ago by
comment:4 Changed 16 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
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 16 years ago by
Component: | core → ajax |
---|---|
Milestone: | → 1.1 |
Resolution: | → fixed |
Status: | reopened → closed |
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)
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:
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