How to update feed using ajax in Rails 4.0

I am trying to create an ajax functionality for a sample app of michael
heart book . I created a feed model controller which is micropost in
hear
book . I am trying to use ajax like post feed method . But I am getting
some error . I am attaching my code below take a look and help me .

feeds_controller.erbclass FeedsController < ApplicationController

    before_action :authenticate_user! ,only: [:create, :destroy]
def create
    @feed = current_user.feeds.build(feed_params)
    if @feed.save
       flash[:success] = "Micropost created!"
      #redirect_to root_url
      respond_to do |format|

      format.html { redirect_to root_url }
      format.js
    end
    else
      @feed_items = []
      render 'static_pages/home'
    end
  end

  def destroy
  end

  private

    def feed_params
      params.require(:feed).permit(:content)
    end
end

And my home page is rendering some partials Here is the code :

static_pages/home.html.erb

<% if user_signed_in? %>



<%= f.submit “Post”, class: “btn btn-primary” %>
<% end %>

_feed.html.erb

<% if @feed_items.any? %>

    <%= render @feed_items %>
<%= will_paginate @feed_items %> <% end %>

So tell me how can I add feed and without refreshing how can I show feed
using partial In this code