从局部视图 MVC 传递变量

Passing Variables from Partial View MVC

我正在创建一个页面,其中 table 从数据库中填充(使用 jQuery)。我试图找出搜索 table 的最佳方法(或者我猜正确的词是 "filter")。 我有一个 "partial view" .cshtml 文件,它在 table 所在的文件内创建了一个搜索栏。我的问题是如何将变量(按下搜索按钮时文本框中唯一的东西)从局部视图文件传递到 "actual" 视图文件,以便我可以将它用作参数过滤器? 我在网上做了很多搜索,但找不到我要找的东西。 预先感谢您的帮助!

Jquery

$(document).ready(function(){
    $.get("~/Student/GetStudent?id=1", function(html){
        //append html
    })
})

C#

假设这个 get 方法在一个名为 Student 的控制器中

[HttpGet]
public ActionResult GetStudent(int id)
{
    //use the paremeter in this case id to create a model with the correct data

    //_StudentPartial being the partial html and model being the model that populates the partial
    return PartialView("_StudentPartial",model);
}