need help here. May I know if I did anything wrong. Apparently, it's not working.
Controller:
[HttpGet]
public IActionResult Index()
{
var data = new List<String>();
data.Add("No");
data.Add("Yes");
data.Add("543");
ViewBag.Name= data;
return View(model);
}
View
function Validation(IsValid) {
var test = '@ViewBag.Name';
var a = "Yes"
for (var z = 0; z < test.length; z++)
{
if (a == test[z]) {
...then..
}
}
}
How do I accessed the "No", "Yes", and "543" inside the JavaScript?