Skip to main content

Bug Tracker

Side navigation

#6424 closed bug (invalid)

Opened April 12, 2010 02:03PM UTC

Closed April 13, 2010 01:20AM UTC

Last modified April 13, 2010 07:15AM UTC

.load callback function bug

Reported by: misssprite Owned by:
Priority: Milestone: 1.4.3
Component: ajax Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

I wrote :

$('#adiv').load('url.html',function(){

alert($('#aspan').text()); //aspan is a span elem in the url.html

});

finally i found i can't select any element in the url.html in the callback function

so i had to use $.ajax, and the $('#adiv').html(...) function.

it seems a bug with jquery

the document tree hasn't been constructed when the callback func is called

Attachments (0)
Change History (3)

Changed April 13, 2010 01:20AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

I am guessing that you may be trying to load an entire html document from url.html, rather than just an html fragment. If that isn't the case, please reopen with a test case. The forum is also a good place to ask questions about suspected bugs before filing a ticket, http://forum.jquery.com .

Changed April 13, 2010 06:54AM UTC by misssprite comment:2

sorry, i made a mistake in the example above.

I indeed loaded a html fragment

so it is:

$('#adiv').load('url.html #anotherdiv',function(){ ...

Strangely, I tried a bare test, leaving only the neccessary elements and it worked! But it doesN'T worked in my real html :( , while the $.ajax and $('#adiv').html(...) way works well

I'm really confused. Probably it's not a bug...

Changed April 13, 2010 07:15AM UTC by misssprite comment:3

the WORKING example did NOT working after i copy it to my tomcat space and access through tomcat

Jesus!

Replying to [comment:2 misssprite]:

sorry, i made a mistake in the example above. I indeed loaded a html fragment so it is: $('#adiv').load('url.html #anotherdiv',function(){ ... Strangely, I tried a bare test, leaving only the neccessary elements and it worked! But it doesN'T worked in my real html :( , while the $.ajax and $('#adiv').html(...) way works well I'm really confused. Probably it's not a bug...