<div class="msg"></div>
<div class="form-wrap" style="display:block">
<%= form_tag('/feedback', remote: true, format: :json, id: 'feedback') do %>
....
def send_email
....
respond_to do |format|
# if success
msg = success ? 'You request will be success processed'
: 'Ooops. Error occurred. Try later.'
format.json { render json: {msg: msg}.to_json }
end
end
$('#feedback')
.on 'ajax:before', ()->
$('.form-wrap').hide()
$('.msg').html('Sending...')
.on 'ajax:success', (e, data)->
$('.msg').html(data.msg)
params[:pages].each_with_index
.wrap{
position: relative;
}
.wrap-scroll{
margin-left: 100px;
width: 300px;
overflow: auto;
}
table{
width: 500px;
}
table td{
width: 100px;
border: 1px solid #ccc;
}
table tr td:first-child{
width: 100px;
position: absolute;
left: 0px;
z-index: 100;
}
<div class="wrap">
<div class="wrap-scroll">
<table>
<tbody>
<tr>
<td>Col-1</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
<tr>
<td>Col-2</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
</tr>
</tbody>
</table>
</div>
</div>