JQuery tabs with Rails: replacing tab content -
i have tab page rendered inside it. good. user clicks button. want output of doing show inside tab. takes user off tabs view entirely.
here's tab html in .html.erb file:
<div id="tabs"> <ul> <li><a href="urls">manage urls</a></li> ...other tabs... </ul> <div id="urls-tab"> <p> </p> </div> ...other tabs... </div>
i have new button on form such:
<%= form_tag('urls/someaction_not_new', :method => :post, :id = "top-form") %> ...content... <input type="button" id="new" value="new" onclick="somejavascript()"> <% end %>
finally, javascript:
$("#tabs").tabs(); function somejavascript() { document.location = "urls/new" }
i know javascript doesn't work, , never expected to. need know how build function such loads 'urls/new' output tab rather redirecting new view w/o tabs.
any appreciated!
use :
function somejavascript() { $('#tabs').load('urls/new') }
it load page 'urls/new' in #tabs
Comments
Post a Comment