MVC:通过 JQuery 从视图传递模型
我认为我传递给它的模型如下:
@model DB.Models.Employees
用户更新模型后,我喜欢通过 Jquery 传递模型。 我有以下代码 - 请注意 url 是我的控制器的路径:
$.post(url, { employeeinfo: '@Model' },
.....
@Model 没有传递整个模型。当我在控制器中查看它的内容时,我得到一个空值。
我正在使用 MVC .NET
I have the following model in my view that I am passing to it:
@model DB.Models.Employees
after the user updates the model, I like to pass the model through Jquery.
I have the following code - note that url is the path to my controller:
$.post(url, { employeeinfo: '@Model' },
.....
@Model did not pass the whole model. I get a null value when I view the content of it in the controller.
I am using MVC .NET
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须获取模型值并将它们放入 JSON 对象中。然后它会将您的模型发送到服务器。
这是一篇关于在发送后将您的模型绑定到您的模型的好文章。
模型绑定
You have to get the model values and put them in a JSON object. Then it will send your model to the server.
Here is a good article on binding your to your model after it is sent.
model binding