我想向控制器发送一个简单的字符串(即 xml )。我不知道为什么没有命中 Visual Studio 中的断点。
这是jQuery代码:
$.ajax({
type: "POST",
url: "BasicWizard/show",
data: "xml="+xmlResult,
success: function (data) {
console.log("Oh yeah !");
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
}
});
这是我在控制器中的方法:
[HttpPost]
public ActionResult show(string xml)
{
try
{
ViewBag.xml = xml;
return PartialView("showXML");
}
catch (Exception)
{
return Content("error");
}
}
我在控制台中只有一个 500 错误。