rails block in js.erb ?

I am trying to run a bloc in a js.erb script , but I don't get ir ...
debugger show that the test is true, so it should run ..

<% if (params[:blog_page].to_i > 0) do %>

   alert("should redisplay the dashboard page");
   window.location.href = <%= backoffice_url %>;
   location.reload();
   $('#blog-info').html( '<%= escape_javascript(render :partial =>
"backoffice/dashboards/lists/blog_info") %>');
   $('#blogInfo').tab('show');

<% end %>

what's wring with tho writing ??

thanks for your feedback

Quoting Erwin <yves_dufour@mac.com>:

I am trying to run a bloc in a js.erb script , but I don't get ir ...
debugger show that the test is true, so it should run ..

<% if (params[:blog_page].to_i > 0) do %>

   alert("should redisplay the dashboard page");
   window.location.href = <%= backoffice_url %>;
   location.reload();
   $('#blog-info').html( '<%= escape_javascript(render :partial =>
"backoffice/dashboards/lists/blog_info") %>');
   $('#blogInfo').tab('show');

<% end %>

what's wring with tho writing ??

The 'do' after the 'if' condition is incorrect. Remove it.

HTH,
  Jeffrey