我嘗試將多個數據發佈到actionresult。window.location.href發送多個參數asp.net mvc
function OnButtonClick() {
var data = {
TextBox1: TextBox1.GetValue(),
TextBox2: TextBox2.GetValue()
};
var PostData1 = data.TextBox1;
var PostData2 = data.TextBox2;
window.location.href ="Home/MyActionResult?Page=data&Post=" + PostData1 + PostData2 ;
}
的ActionResult:
public ActionResult MyActionResult(string PostData1, string PostData2)
{
return view();
}
我可以給PostData1值,但是我不能發送PostData2值actionresult.So我如何通過使用窗口發送PostData1和PostData2值加在一起.location.href?
它們的值是什麼? 'PostData1 +「和」+ PostData2「?或'encodeURIComponent(PostData1 + PostData2)' –