Jquery 原型发布数据未通过asp.net mvc Actionrequest
需要帮助吗。真的比什么都糊涂 我有ASP.NETMVC控制器Jquery 原型发布数据未通过asp.net mvc Actionrequest,jquery,asp.net-mvc,prototypejs,Jquery,Asp.net Mvc,Prototypejs,需要帮助吗。真的比什么都糊涂 我有ASP.NETMVC控制器 [AcceptVerbs(HttpVerbs.Post)] public ActionResult Dashboard(string Whatever) { //Save name to database System.IO.StreamWriter swLogFile = new StreamWriter(@"c:\temp\test.txt", true); swLo
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Dashboard(string Whatever)
{
//Save name to database
System.IO.StreamWriter swLogFile = new StreamWriter(@"c:\temp\test.txt", true);
swLogFile.WriteLine(Convert.ToString(DateTime.Now) + ":" + Convert.ToString(DateTime.Now.Millisecond) + " - " + Whatever);
swLogFile.Close();
return Content("success");
}
我只想捕获通过视图表单上的原型传递数据时从字符串传递的内容
new Ajax.Request(this.options.saveurl,
{method:'post', Whatever:"Scott", onComplete:function(t)
{$('data').update(t.responseText + $('data').innerHTML);
} });
但是,当它执行时,“Whatever”总是空的。我错过了什么吗。如果我使用jQuery,我不会遇到任何问题。
我的jQuery示例
jQuery.noConflict();
jQuery.post("/Home/Dashboard/Dashboardsave", { Whatever: "Scotta" }, function(data) { alert(data); });
有人知道我做错了什么吗
Scotty您可以使用parameters属性:
new Ajax.Request(this.options.saveurl, {
method: 'post',
parameters: { Whatever: 'Scott' },
onComplete: function(t) {
$('data').update(t.responseText + $('data').innerHTML);
}
});