You shouldn't be passing the List<Student object directly to your script as the object is not in a format js can read or work with so you need to JSON serialize the object into a JSON string which you can then include in the data body of your post request.
You can serialize the object with Newtonsoft.Json and you need to make sure the listSTD variable is instantiated inline when the view is rendered rather than in an external file (the rest of your code can be in an external js file). For example:
<html>
<body>
@{ List<Student> StudentList = ViewBag.StudentList; }
<script>
var listSTD = "@JsonConvert.SerializeObject(StudentList)";
</script>
</body>
<html>
On the server-side controller action responding to your post request at /Students/Check you can de-serialize the posted student list JSON back into List<Student> For example in your controller action:
public class StudentsController
{
public ActionResult Check(StudentsCheckViewModel model)
{
int id = model.id;
List<Student> Students = Json.DeserializeObject<List<Student>>(model.listSTD);
}
}
And the view model:
public class StudentsCheckViewModel
{
public int id { get; set; }
public string listSTD { get; set; }
}
= @StudentList;is clearly invalid. The view has access to the model, the Temp dictionary and the ViewBag. If you want to access something from the ViewBag use the same syntax you use in C#, eg@ViewBag.StudentList. Everything after that@is C# code