【发布时间】:2014-02-12 19:31:22
【问题描述】:
您好,有没有人可以帮助我解决以下问题。我有 jquery ajax get(http get) 请求和
有成功数据,问题是如何将数据绑定到 html 表单或 html helper 类
喜欢(@html.Dropdownlist ,@html.TextBox),
实际上,我试图在 jquery 和 ajax 的帮助下将一个视图称为创建和编辑,我一度陷入困境,请帮帮我,,
我的jquery代码是
$.ajax({
type: 'Get',
url: geturl,
data: {
orderid: $(this).data('id')
},
success: function (response) {
var CustomerID = response.cID;
var ShipName = response.ShipName;
$("#CustomerID").html(CustomerID);
$("#ShipName").html(ShipName);
return false;
},
error: function (e) { alert(e.error); }
});
如何将响应数据绑定到 html 助手类属性,就像我想将 cID 绑定到 CustomerID
我的查看代码是
enter code here
<form id="myform" >
<div>`enter code here`
@Html.Label("Ship Name", "ShipName");
@Html.TextBox("ShipName", "");
</div>
<div class="editor-label">
@Html.Label("Customer", "CustomerID")
</div>
<div class="editor-field">
@Html.DropDownList("CustomerID", String.Empty)
</div>
【问题讨论】:
标签: jquery ajax asp.net-mvc