In my application,I am showing list of items in one page and there will
be “Add” button to add new item. When i click that “add” button, i will
open up a small POPUP WINDOW, and i will enter details about the item to
be added(form page). What happens is, after adding an item,the popup
page shows the form page again (intentionally given) but it does not
show any response message like “Item is successfully added”. Item list
in the base page(main window)does not update the list automatically. I
had to refresh and view the updated list.
-----------controller for item creation---------
def create
@item = Item.new(params[“item”])
@item.user_id = @session['user'].id
if @item.save
#TODO need to find out how to get params that in a array
tag = Tag.new(params[:tag]);
print "*********\n "
print tag.tagString
print "\n*********** "
tag.tagString.each(',') { |s| tmpTag = Tag.new ;
tmpTag.tagString = s.chomp(","); tmpTag.save;
itemToTag = ItemToTag.new
itemToTag.item_id = @item.id;
itemToTag.tag_id = tmpTag.id;
itemToTag.save;
}
redirect_to :action => 'new'
flash[:notice] = 'Item was successfully created.'
else
render :action => 'new'
end
end
-----controller for showing list of items------------------------
def myItemList
@item_pages, @items = paginate :items, :per_page => 10 , :conditions
=> "user_id = " + @session[“user”].id.to_s
render :partial => ‘myitemList’
end
What i want is,
-
when i add a new item in the popup, the base page should
automatically
update its list with out refreshing the browser window. -
Popup window should display response text(response text will be in
DIV tag)
How can i do that? Any help is highly appreciated.
Thanks in advance
Rubyquest