I am a newbie to Rails. Trying to make a small contact form app. I want to 
use AJAX to add new contact. I want a dialog to open when I click on 'New 
Contact' button and then entering details over there. I did following steps:

1] added :remote => true to the new_contact_path line on index.html.erb.
2] Made a div with id="new_contact" as following
        <div id="new_contact" ></div>
3] Created new.js.erb with following code
          $("#new_contact").dialog({
          autoOpen: true,
           height: 600,
           width: 600,
           modal: true,
          title: 'New Contact',
         buttons: {
            "Create": function() { $("#new_contact").submit() },
             },
            open: function() {
            $("#new_contact").html("<%= escape_javascript(render('form')) 
%>")
             },
            });
4] Added format.js in the controller action "new".


But when I click on "New contact" button, nothing happens. Instead of the 
jquery code I have mentioned above if I am using an alert, it is being 
displayed. 

Kindly help asap.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/IFEtIGxjdzAJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en-US.

Reply via email to