gpt4 book ai didi

jquery - MVC Controller 参数为空

转载 作者:行者123 更新时间:2023-12-01 02:53:33 24 4
gpt4 key购买 nike

这看起来很基本,但出于某种原因我无法让它工作。

Jquery..

$.post("/Member/Profile", "TESTDATA", function (result) {
console.log(result);
});

Controller

[HttpPost]
public JsonResult Profile(string model)
{
return Json(1);
}

我的字符串模型参数传入为空,当我在它上面设置断点时我可以看到这一点。我尝试让它传递 json,尝试让它传递 viewmodels,尝试使用 ajax 并将类型/方法设置为“POST”..我的参数似乎总是为空。我做错了什么?!

最佳答案

试试这个?

$.post("/Member/Profile", {model: 'TESTDATA'}, function (result) {
console.log(result);
});

关于jquery - MVC Controller 参数为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34221424/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com