我的页面左侧有一个包含导航的div。但是,当用户点击链接时,它只会更改页面右侧的内容。有没有办法只在点击链接时加载右侧?例如,当单击“navPanel”中的链接时,“contentPanel”应该重新加载该链接上的内容。
<nav id="navPanel">
<a>link 1</a>
<a>link 2</a>
<a>link 3</a>
</nav>
<div id="contentPanel">
<p>Content</p>
</div>
答案 0 :(得分:-1)
是的,您可以使用名为load()的jQuery函数。
rails generate my_gem_name:install
Running via Spring preloader in process 42586
create lib/templates/coffee/assets/javascript.coffee
rails generate scaffold user email first_name last_name
Running via Spring preloader in process 43054
invoke active_record
create db/migrate/20170721152013_create_users.rb
create app/models/user.rb
...
invoke assets
invoke coffee
create app/assets/javascripts/users.coffee
...
cat app/assets/javascripts/users.coffee
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
SomeJavascriptCode.doSomething({model: 'User'})