1

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);
    });
});
user2851100
  • 141
  • 2
  • 5
  • Can you show any attempts you have tried thus far? – Durandal Feb 17 '14 at 07:47
  • I want to achieve basic ajax page operation:&Click on the left nav bar,then modify right div content &Click a button then show some content on the another div. – user2851100 Feb 17 '14 at 08:02

0 Answers0