再会
我正在使用一种使用敲除来添加数据的表单。现在,当单击“删除”按钮(见下文)时,它会删除条目而不会发出警告。我如何首先提醒用户他将要删除该项目?
谢谢
HTML
<td><input type="button" class="register" value="Remove" data-bind="click: function(){ vm.Remove($data) }" /></td>
昏死
var vm = {
Data: ko.observable(),
Remove: function (card)
{
console.log(card.CardId());
var d = {
cardId: card.CardId()
}
var options =
{
url: "MyAccount.aspx/DeleteCard",
type: "POST",
contentType: "application/json",
data: JSON.stringify(d),
success: function (response)
{
window.location = window.location;
}
}
$.ajax(options);
}
}
var cardsBound = false;
$(document).ready(function () {
LoadCards();
$("#")
});
function LoadCards() {
var options =
{
url: "MyAccount.aspx/GetCardTypes",
type: "POST",
contentType: "application/json",
success: function (response) {
vm.Data(ko.utils.unwrapObservable(ko.mapping.fromJS(response.d)));
if (!cardsBound)
ko.applyBindings(vm);
cardsBound = true;
}
}
$.ajax(options);
}