這裏是所有代碼:
$(document).ready(function() {
$("#dialog-form").dialog({
autoOpen: false,
closeOnEscape: false,
draggable: true,
height: 'auto',
width: 'auto',
modal: true,
buttons: {
"Ok": function() {
var fok = $('#montantrecu').validationEngine('validate');
if (!fok) {
$(this).dialog("close");
$.ajax({
type: "POST",
url: '<%=ResolveUrl("~/Services/Services.asmx/Facture")%>',
data: "{'IdMembre':'" + $('#hdId').val() + "', MontantFacture': '" + $('#montantrecu').text + "' }",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (response) {
alert("Ok");
},
failure: function (response) {
alert("failure");
},
error: function (request, status, error) {
alert(request.responseText);
}
});
}
},
"Annuler": function() {
$(this).dialog("close");
}
}
});
$("#lbCreer").click(function (e) {
e.preventDefault();
$("input:checked").each(function() {
var id = this.value;
$("#hdId").val(id);
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '<%=ResolveUrl("~/Services/Services.asmx/GetNomPrenom")%>',
data: "{'IdMembre':'" + id + "'}",
dataType: "json",
async: false,
success: function (response) {
$("#liNom").text(response.d);
},
failure: function (response) {
alert("failure");
},
error: function (request, status, error) {
alert(request.responseText);
}
});
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '<%=ResolveUrl("~/Services/Services.asmx/GetMontantCotisation")%>',
data: "{'IdMembre':'" + id + "'}",
dataType: "json",
async: false,
success: function (response) {
$("#montantrecu").val(response.d);
},
failure: function (response) {
alert("failure");
},
error: function (request, status, error) {
alert(request.responseText);
}
});
$("#dialog-form").dialog("open");
});
alert('toto');
});
});
你可以'對話框打開跳出循環後返回FALSE',但爲什麼,如果你想打開對話框後,打破了你需要一個循環? – 2014-10-30 19:47:48
我打開對話框,然後用戶確認服裝和當用戶點擊確定按鈕,我做了一個過程。我想爲所有的複選框做好準備。我不知道我的英語 – Eric 2014-10-30 19:58:32