I have a simple javascript
function in a partial view:
@section Scripts{
<script type="text/javascript">
function showErrors(data) {
alert('show errors');
}
</script>
}
and I need to call this function from my partial view razor
code. I've tried something like:
@if (Model.ErrorMessage.Count > 0)
{
var errors = Html.Partial("_errors", Model.ErrorMessage);
<script type="text/javascript">showErrors(@errors)</script>
}
but it's not working. I can't call this function when the page loads because this view will be rendered trough ajax
call...
Any ideas on how to modify this code so that the javascript method is called from my partial view when it's loaded?