Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#6424 closed bug (invalid)

.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

Change History (3)

comment:1 Changed 10 years ago by dmethvin

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 .

comment:2 Changed 10 years ago by 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...

comment:3 in reply to:  2 Changed 10 years ago by misssprite

the WORKING example did NOT working after i copy it to my tomcat space and access through tomcat Jesus! Replying to 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...

Note: See TracTickets for help on using tickets.