I have partial view for rating. This view is repeated multiple time on a single page. I have written the functional code for rating in an external js file. Now I want to call that js file each time rating view is loaded. Also I want to pass parameter to the external js file. I have tried the following method to do this:
<script type="text/javascript" >
var EntityId="@ViewData["entityid"]";// parameters which i want to pass
var RatingValue="@ViewData["rating"]";// parameters which i want to pass
var EntityName="@ViewData["entityname"]";// parameters which i want to pass
</script>
<script type="text/javascript" src="../../Scripts/RatingControl.js"></script>
The code above is working but the external script only access last value of passed variable e.g. there is 5 records on my page then the rating control will be added 5 time with different value. But in external file I only get last records rating value.
So how can I call external js file from javascript code on each partial view load event.