<table class="table table-bordered">
<tr>
<td>商品名称:</td>
<td><input id="name" type="text" /></td>
</tr>
<tr>
<td>商品颜色:</td>
<td><input id="color" type="text" /></td>
</tr>
<tr>
<td>商品尺码:</td>
<td><input id="size" type="text" /></td>
</tr>
<tr>
<td>商品价格:</td>
<td><input id="price" type="text" /></td>
</tr>
<tr>
<td><input id="Button1" type="button" value="修改" onclick="upt()" /></td>
<td></td>
</tr>
</table>
<script>
var id = document.cookie;
//添加商品
function upt() {
var obj = {
GName: $("#name").val(),
GColor: $("#color").val(),
GSize: $("#size").val(),
GPrice: $("#price").val(),
GId: id
};
$.ajax({
url: "http://localhost:51518/api/Shop/UpdateGood",
data: obj,
type: "post",
dataType: "json",
success:
function (d) {
if (d > 0) {
alert('修改成功!');
location.href = "/Default/ShowGood";
}
else {
alert('修改失败!');
}
}
})
}
</script>