Hi,

So, I'm attempting to add HTML to a document via Ajax, but when I get
back the content, I'm finding that no matter what I try, I can't get
it added to the DOM correctly. Basically I'm doing this:

$.post('ajax.php',
     function (data) {
          var html = data.content;
          $('#somediv').append(html);
     }
);

The HTML I'm loading looks like this:

<div class="somediv">
        <form id="someform">
                <p class="someclass">Name:</p>
                        <input style="display: none;" type="textbox" 
name="somefield"
value="test" />
                </p>
        </form>
</div>

While the content does show up in the div, if I try to get the form by
doing $('#someform'), jQuery returns nothing. I've tried using .append
() and .html(), and neither way gives me what I want. Is there
something I'm missing here? I know adding objects to the DOM in jQuery
is ridiculously easy, so I feel like I'm either running up against
something impossible, or I have a hugely flawed concept of how append
() and html() work.

Reply via email to