1
0
Fork 0
mirror of https://github.com/kbparagua/paloma synced 2023-03-27 23:21:17 -04:00

Add manual test to AJAX request

This commit is contained in:
kbparauga 2015-04-25 17:21:02 +08:00
parent c971ba5de7
commit e212c79ca0
5 changed files with 25 additions and 0 deletions

View file

@ -52,3 +52,16 @@ Foos.prototype.otherAction = function(){};
var NotFoos = Paloma.controller('NotAdmin/Foos');
NotFoos.prototype.show = function(){};
NotFoos.prototype.otherAction = function(){};
$(document).ready(function(){
$('#js-ajax-link').on('click', function(e){
e.preventDefault();
$.get($(this).prop('href'), function(response){
$('#js-ajax-response').html(response);
Paloma.executeHook();
Paloma.engine.start();
});
});
});

View file

@ -40,6 +40,11 @@ class MainController < ApplicationController
end
def ajax
render :ajax, :layout => false
end

View file

@ -19,11 +19,15 @@
<li><%= link_to 'Main#basic_params', basic_params_main_index_path %></li>
<li><%= link_to 'Main#xml_response', xml_response_main_index_path %></li>
<li><%= link_to 'Main#file_response', file_response_main_index_path %></li>
<li><%= link_to 'Main#ajax', ajax_main_index_path, :id => 'js-ajax-link' %></li>
</ul>
</div>
<hr/>
<div id='js-ajax-response'>
</div>
<%= yield %>
<%= insert_paloma_hook %>

View file

@ -0,0 +1,2 @@
<h1>Main#AJAX</h1>
<%= insert_paloma_hook %>

View file

@ -12,6 +12,7 @@ TestApp::Application.routes.draw do
get :js_response
get :xml_response
get :file_response
get :ajax
end
end