For this you need to add another param with paginate.
<%= paginate @products, :remote => true, :param_name => param_name %>
This params name will pass as parameter to controller so you can control which ajax pagination you are calling.
If you are calling same action then on the basis of param name you can change the value of @products
also. One more thing you need to consider in your xxxx.js.erb
file you need to render paginate object also.
In your js file you can change html on the basis of param also.
- if params[:xxx]
$('#xxx').html('#{escape_javascript render(:partial =>"partial_name",:locals => { :posts => @products, :param_name => 'xxx'})}');
$('#xxx #paginator').html('#{escape_javascript(paginate(@products, :remote => true, :param_name => 'xxx').to_s)}');
- if params[:yyy]
$('#yyy').html('#{escape_javascript render(:partial =>"partial_name",:locals => { :posts => @products, :param_name => 'yyy'})}');
$('#yyy #paginator').html('#{escape_javascript(paginate(@products, :remote => true, :param_name => 'yyy').to_s)}');
In your controller you should use param_name
instead of params page