新手问题 jquery ajax 问题

xiaoxiao · January 15, 2013 · Last by xiaoxiao replied at January 17, 2013 · 2464 hits

我的脚本语言

$("#ajax").click(function(){
$.ajax({
  url: "home/new",
  success: function(html){
    $("#ajax").append(html);
  }
});
});

每次我点击 id 为 ajax 的内容时,都会加载整个网页,包括 application.html.erb 中的 header 内容。有什么办法只加载 home/new 中的内容

jq load('home/new' ,'head')

还个问题就是每次 load 的 page 相当于 load 整张 page 包括所有的 js 文件,只不过网页前台只显示了部分内容,后台还是执行了整张 page,效率就很低了,怎么解决这个问题,,thx

#3 楼 @xiaoxiao 在 new action 里设置 render :layout =>false 呢

You need to Sign in before reply, if you don't have an account, please Sign up first.