Is this correct to send an ajax request? This code isn't working, what do I need to change here? Any better way to send an ajax form?
<%= form_tag item_create_path, :remote => true, :id => 'create_item' do %> <p> <b> <%= label_tag :"Name" %></b> <%= text_field_tag :name, nil, :maxlength => 40, :size => 70 %> <b> <%= label_tag :"Date" %></b> <%= text_field_tag :date, nil, :maxlength => 10, :size => 10, :value => Time.now.utc.strftime("%Y-%m-%d") %> <b> <%= label_tag :"Time" %></b> <%= text_field_tag :time, nil, :maxlength => 10, :size => 10, :value => Time.now.localtime.strftime("%H:%M:%S") %> </p> <p> <b> <%= label_tag :Description %></b> <%= text_field_tag :description, nil, :maxlength => 50, :size => 50 %> </p> <%= hidden_field_tag :type, nil, :value => "new" %> <p class="button"><%= submit_tag " Create ",:onclick=>"javascript:submitForm()" %></p> <% end %> function submitForm() { $.ajax({type:'POST', url: '/item/create', data:$('#create_item').serialize(), success: function(response) { $('#create_item').find('#item').html(response); }}); return false; }