将值从控制器传递到视图
本文关键字:视图 控制器 | 更新日期: 2023-09-27 18:11:32
控制器
public ActionResult Booklist(string bookid) {
return View();
}
视图// other codes
url: 'Index/Booklist',
method: 'POST',
success: function (a) {
var windows = window.open('Index/Booklist');
}
但是它似乎调用了dispose();
两次,原因是它第一次调用return View();
,第二次调用var windows = window.open('Admin/GenerateQRCode');
我需要将数据从控制器传递到sencha中的javascript,并将它们传递到视图..这是可能的吗?
试试这个:
public ActionResult Booklist([DataSourceRequest] DataSourceRequest request,string bookid)
{
//result should be your data.
var result=0;
return Json(result, JsonRequestBehavior.AllowGet);
}
// other codes
url: 'Index/Booklist',
method: 'POST',
data:{
'bookid': bookid
},
success: function (result) {
}
Please try this..对不起,前面那个坏了…
$.ajax({
url: "@Url.Action("Booklist", "Home")",
data: {
'bookid': bookid
},
dataType: 'json',
async: true,
type: 'POST',
success: function (response) {
}
});
public ActionResult Booklist( string bookid)
{
var result=1;
return Json(result, JsonRequestBehavior.AllowGet);
}