Hi @N.Kavin,
You need to pass the parameter as a string literal. Wrap it with single quotes or double quotes.
If the function is inside an external js file, you need to make sure to include/load it before executing the method.
@if (Model.errors != null)
{
foreach (var er in Model.errors)
{
<script src="~/area.js"></script>
<script type="text/javascript">
cm_toast("warning", '@er.ErrorHeading', '@er.ErrorMessage');
</script>
}
}
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.