更新时间:2023-11-15 14:02:52
( #text1\" 中跨度>)VAL())。
var url1 = / Home / function1 跨度>;
var data1 = { id:id1};
.post(url1,data1,function(data){
( #tb3)。val(数据);
HomeController.cs[HttpPost]
public JsonResult function1(int id)
{
List < 表1 > the1 = new List < 表1 > ();
.. 。
返回Json(the1,JsonRequestBehavior.AllowGet);
}
How do I print out in "#tb3" the json string from function1.
Right now it prints out:
[object Object]
Index.cshtml
var id1 = parseInt($("#text1").val());
var url1 = "/Home/function1";
var data1 = { "id":id1 };
$.post(url1, data1, function (data) {
$("#tb3").val(data);
HomeController.cs
[HttpPost]
public JsonResult function1(int id)
{
List<Table1> the1 = new List<Table1>();
...
return Json(the1, JsonRequestBehavior.AllowGet);
}
("#text1").val()); var url1 = "/Home/function1"; var data1 = { "id":id1 };
.post(url1, data1, function (data) {
("#tb3").val(data);
HomeController.cs[HttpPost] public JsonResult function1(int id) { List<Table1> the1 = new List<Table1>(); ... return Json(the1, JsonRequestBehavior.AllowGet); }