Side navigation
#814 closed bug (fixed)
Opened January 15, 2007 06:41PM UTC
Closed January 20, 2007 04:05AM UTC
Last modified October 14, 2008 10:47AM UTC
Calling load(url, data) causes "fn.apply is not a function" error.
Reported by: | tuupola@appelsiini.n | 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
Attachments (0)
Change History (5)
Changed January 16, 2007 01:15AM UTC by comment:1
Changed January 16, 2007 11:39AM UTC by comment:2
Fixed. 1/16/2006.
Changed January 17, 2007 01:31PM UTC by comment:3
resolution: | → fixed |
---|---|
status: | new → closed |
Fixed in revision 1093.
Changed January 18, 2007 07:43PM UTC by comment:4
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
Changed January 20, 2007 04:05AM UTC by comment:5
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:
$('#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