I am a newbie of web develop, I am learning padrino framwork. But offical guide is lack of ajax content. Can any one supply me a doc or example for ajax in padrino? eg,modifiy div .
I wrote a app,but ajax dont works fine.The refresh.js content is displayed on the #cn-status div.Followin is my ruby program
#controller
#----------------------------
get :refresh, :provides => :js do
if request.xhr?
# refresh.js.erb is js file for modify div content
render "aj/refresh", :layout => false
else
redirect url('aj/')
end
end
#link on the other erb file
<li><%= link_to 'get', url(:aj, :refresh, :format => :js), :confirm => "Are You Sure?", :remote => true %></li>
#refresh.js.erb file
$(document).ready(function(){
$("#cn-status").load("/cj/refresh_codename_get",function(responseTxt,statusTxt,xhr){
if(statusTxt=="error")
alert("Error: "+xhr.status+": "+xhr.statusText);
});
});