I am pulling my hair out over this.  I swear that this is a bug.

For some reason, I CANNOT target any forms within the html response.
I have tried very simple examples and it still won't work.  Here is
what I have, that still returns undefined:

HTML:
<form id="test" action="http://test.com";>
<span id="test2">this is my text</span>
</form>

jQuery:
success: function(html){
  alert($(html).find("#test").attr('action'));
  alert($(html).find("#test2").text());
}

#test2 works, but #test never does, and it seems this is because it is
a form.  Have I done something wrong here?  Can I not target a form?

On Apr 12, 4:35 pm, Nic Hubbard <nnhubb...@gmail.com> wrote:
> I have an ajax GET call that returns the HTML of a page on my server.
> Within that page is a form with a specific ID.  I know it is there, I
> can see it in the response in Firebug, but when I try to get
> attributes of that ID, it always returns undefined!  What have I done
> wrong here?
>
> success: function(html){
>
> $(html).find('#main_form').each(function() {
> var linking_data = $(this).serialize();
> var form_action = $(this).attr('action');
> alert(form_action);
>
> });
> }
>
> I have tried to not use each() and that still returns undefined.  I
> don't get it.

Reply via email to