javascript is not working in render_component

Hi,
    I am calling on action using render_component,in that action i am
again calling one javacritp function.when i am execute this code the
script is not working,my code is here.

my view goes here:
rating :
<%=render_component(:controller=>'products',:action=>'star_display',:params=>{:product_id=>2})%>

action is
def star_display
  product_id=params[:product_id]
  overall_rating=ProductRating.find
  rating=overall_Rating
end

My star_display view is
<img src="/images/star1.gif" id="star1">
<img src="/images/star1.gif" id="star2">
<img src="/images/star1.gif" id="star3">
<img src="/images/star1.gif" id="star4">
<script language="javascript" type="text/javascript">
showAllStars(<%=@rating%>);
</script>
here the script is not working.but if i print anything inside of the
script tag it gets printed means the action executed successfully but
the script is not running.i don't know what's the reason please anybody
help me.

thanks,
Bala

Hi,
   I am calling on action using render_component,in that action i am
again calling one javacritp function.when i am execute this code the
script is not working,my code is here.

You don't seem to be setting @rating in your action. Have you tried
using firebug to step through your javascript and see where it is
failing ?
(oh and render_component is deprecated and very rarely the right thing
to do)

Fred