<table>
<tr>
<th>pic</th>
<th>Id</th>
<th>Name</th>
<th>P1</th>
<th>P2</th>
<th>P3</th>
<th>P4</th>
<th>Promotion</th>
<th>New</th>
<th>Score</th>
<th>S1</th>
<th>Description</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @products.each do |product| %>
<tr>
<td><%=image_tag product.i1.url(:thumb)%></td>
<td><%= product.id %></td>
<td><%= product.name %></td>
<td><%= product.p1 %></td>
<td><%= product.p2 %></td>
<td><%= product.p3 %></td>
<td><%= product.p4 %></td>
<td><%= product.promotion %></td>
<td><%= product.new %></td>
<td><%= product.score %></td>
<td><%= product.s1 %></td>
<td><%= product.description %></td>
<td><%= link_to 'Show', admin_product_path(product) %></td>
<td><%= link_to 'Edit', edit_admin_product_path(product) %></td>
<td><%= link_to 'Destroy', admin_product_path(product), :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<input type="text" id="source" name="source" value="" />
<%=will_paginate @products%>
<script type="text/javascript">
//$('.pagination a').attr('data-remote', 'true');
$('.pagination a').click(function(){
alert($(this).attr("href"));
var result="";
var subject=$(this).attr("href");// /admin/products/search?page=9
var myregexp = /\/admin\/products\/search\?page=(\d+)/;
var match = myregexp.exec(subject);
if (match != null) {
result = match[1];
}
alert(result);
$("input[name='page']").val(result);
$("#source").val("");
alert($("#form2").serialize());
$.post($("#form2").attr("action")+".js",$("#form2").serialize(),null,"script");
return false;
});
</script>