0
私はテーブルに取り組んでいます。私のテーブルには多くのcolumn.inがあります。実際には"#btnnVerify"
を最初の行にクリックするとtextarea
のカラムを更新したいと思います。AJAX
は完全に動作しますが、"#btnnVerify"
2番目の行それは働いていませんでした。私はjQuery
コードで警告機能を追加しましたが、2行目では機能しませんでしたが、最初の行では完全に機能します。jQuery AJAXが2行目で動作しないのはなぜですか?
<table>
<td>
<input type='checkbox' id="StockIDCheckBox" name='result' [email protected] />
<tr>
</td>
<td>
@Html.TextAreaFor(modelItem => item.Description, new { id = "description", @row = "50", @cols = "5", @class = "form-control" })
</td>
<td>
<a class="btn btn-info btn-sm" data-toggle="modal" data-target="#verify" id="btnnVerify" onclick="SaveandVerify(@item.StockID)">
<i class="glyphicon glyphicon-ok"></i>
</a>
</td>
<td>
<a class="btn btn-danger btn-sm" data-toggle="modal" data-target="#Reject" onclick="RejectGroup(@item.StockID)">
<i class="glyphicon glyphicon-remove"></i>
</a>
</td>
</tr>
</table>
function SaveandVerify(id) {
$.get("/Admin/VerifyStockBuy/SaveandVerify/" + id, function (result) {
$("#verify #myModalLabel").html(" وضعیت درخواست این کالا در این کارگاه ");
$("#verify #myModalBody").html(result);
});
}
function RejectGroup(id) {
$.get("/Admin/VerifyStockBuy/Reject/" + id, function (result) {
$("#Reject #myModalLabel").html("رد درخواست");
$("#Reject #myModalBody").html(result);
});
}
$(document).ready(function() {
$('#repAll').DataTable({
"ordering": true,
"language": {
"search": "جستجو",
"paginate": {
"previous": "قبلی",
"next": "بعدی"
},
"sLengthMenu": "نمایش _MENU_ ردیف",
"sInfo": "نمایش _START_ تا _END_ ردیف از _TOTAL_ ردیف",
"sEmptyTable": "هیچ داده ای در دسترس نیست",
"sInfoEmpty": "نمایش 0 ردیف از 0 ردیف",
},
"columnDefs": [{ width: 1000, targets: 0 }],
});
$("#btnnVerify").click(function() {
var Desc = $("#description").val();
var stockId = $("#StockIDCheckBox").val();
alert(Desc + ":" + stockId);
$.ajax({
url: '/VerifyStockBuy/EditDescription/',
data: { id: stockId, Description: Desc },
type: 'Post',
dataType: "text",
success: function (data) {
}
});
});
});
[HttpPost]
public ActionResult EditDescription(int id, string Description)
{
var desc = db.StockBuys.Find(id);
desc.Description = Description;
db.SaveChanges();
return Content(Description);
}
そのに基づいて、クリックイベントに与える必要があるため、クラス –
@ IbraHimM.Nadaに基づくクリックイベントで、ありがとうa lot.itは非常にnice.you私の人生を保存して動作します –
私の答えをマークしてください:) –