[jQuery] Trouble with Ajax Buttons Inside Facebox Lightbox
I'm trying to have a few text fields inside of a lightbox like: Name
and Subdomain with an image(submit button) to POST those values back
to the server. When they aren't in the lightbox, it works fine but
when I pull it into the lightbox, the image isn't able to POST back to
the server -- I assume it isn't bound and doesn't register the click.
Here is some code to hopefully help show what I mean: (sorry the HTML
is actually HAML)
HTML
--------
%div#company_fields
= text_field_tag "name", {}, :id => 'name'
%br
= text_field_tag "subdomain", {}, :id => 'subdomain'
%br
= image_tag 'http://static.px.yelp.com/photo/
hjVFsGNH7MwGUH_Ww8f4Rw/ss', :id => 'test_create'
JS
---
// Ajax create
$('#test_create').click(function() {
$.post('http://localhost:3000/users', {'users[name]': $
('#name').val(), 'subdomain':
$('#subdomain').val()}, function(data) {
alert('data');
});
});
--I changed the code around a bit but I assume you can get the idea.
Any ideas?