1. 前台
<script type="text/javascript">
$(document).ready(function () {
$("#btnGetJson").click(function () {
var flowId = $("#txtFlowId").val();
// alert(flowId);
$.getJSON("/Flow/getJson", { "flowId": flowId }, function (data) {
// alert(data);
var htmlText = "<tr>";
var fId = $(data).attr("flowId");
var flowName = $(data).attr("flowName");
var currUser = $(data).attr("currUser");
htmlText += "<tr><td>" + fId + "</td><td>" + flowName + "</td><td>" + currUser + "</td></tr>";
htmlText += "</tr>";
$("#jsonTable").html(htmlText);
});
});
});
</script>
<input id="btnGetJson" type="button" value="GetJson" />
<table id="jsonTable">
</table>
2. 后台 Controller
//输入流程Id,返回一个json
[HttpPost]
public ActionResult getJson(string flowId) {
FlowVo flow = new FlowVo();
flow.flowId = flowId;
flow.flowName = "OverFlow e-flow_" + flowId;
flow.currUser = "currUser_" + flowId;
return Json(flow, JsonRequestBehavior.AllowGet);
}