1def test
2 some_parameter = params[:some_parameter]
3 # do something with some_parameter and return the results
4
5 @test=books.find.last
6 respond_do |format|
7 format.html
8 format.json {render json: @test}
9 end
10end
1$.ajax({
2 type:"GET",
3 url:"books/test",
4 dataType:"json",
5 data: {some_parameter: 'hello'},
6 success:function(result){
7 alert(result);
8 }
9})