Have you tried it without the data.content?

IE: var html = data;

that should get you all of the HTML you're pulling in via AJAX. I
haven't ever seen the .content method before, and a quick Google
search came up with nothing for it.. maybe that's the problem? I'm
sure someone who knows more will come in and blast my answer, but
that's my thought.

Hope that helps.

- T.J.

On Dec 14, 10:05 am, joseph7 <radioak...@gmail.com> wrote:
> 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