My problem is the following, I use jquery to get div content but .find() return null.
We can view the source code here: http://webdevs-bg.net/web/html5pload/js.html and open your console to view the log from find().
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your response is returning an entire HTML document. Don’t do that. You’ll have trouble traversing it because different browsers behave differently when dropping an entire document into a jQuery object.
A temporary fix may be to use the
filter()[docs] method instead of.find().I’m guessing you’re testing on a browser that strips out everything but the content of the
<body>, leaving the"#content"element at the top level where.find()can’t locate it.Note that this won’t work in all browsers, which is why you’d need to only return the content you actually want.
Also, you’re appending a new element with
#contentto an existing element on the page with the same ID. I assume you’d only want to append its children.This should be your response:
…but instead you sent this: