Using AJAX on rails page

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


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.