<script>
@if (!ViewData.ModelState.IsValid && ViewData.ModelState["Error"] != null)
{
    <text>
    var errors = new Array();
    </text>

    foreach (var error in ViewData.ModelState["Error"].Errors)
    {
<text>
    errors.push('@error.ErrorMessage');
</text>
    }
    
    @:global.showErrorMessage(errors);
    
}

</script>
