現在、AJAX の投稿が成功した場合にダイアログ ボックスが表示されるように設定しています。AJAX の投稿は成功しましたが (以下のアラートが発生しています)、ダイアログ ボックスが表示されません。理由がわかりません。ここに私のマークアップがあります:
<a data-eventid="@item.EventId" id="raffle-@item.EventId" class="raffle-charity-button" href="#"><img src="~/Images/Raffle.png" alt="Raffle" title="Pick a winner!"/></a>
<div id="raffle-event-dialog">
<p class="dialogDisplayWinner">
</p>
</div>
...そして、ここに私のスクリプトがあります:
$(".raffle-charity-button").click(function() {
charityEventId = $(this).data("eventid");
//charityEventId = parseInt($(this).attr("id").split("-")[1]);
var url = "@Url.Action("Raffle", "DonationEvent")";
var postData = {
id: charityEventId
};
$.ajax({
type: "POST",
url: url,
data: postData,
datatype: "json",
success:
function(data) {
if (data != "") {
if (data.Success == "false") {
window.location = "../Error";
} else {
var originalVerbiage = "The winner of the raffle is... "
$(".dialogDisplayWinner").empty();
$(".dialogDisplayWinner").append(originalVerbiage + "test");
$("#raffle-event-dialog").dialog({
modal: true,
autoOpen: false,
buttons: {
"OK": function() {
$("#raffle-event-dialog").dialog("close");
}
},
resizable: false
}
);
alert(data.Success);
}
}
},
error:
function(jqxhr, ajaxOptions, thrownError) {
alert("An error occurred: error Code(" + jqxhr.status + ") message: " + jqxhr.responseText);
}
});
});
私が見落としているのは明らかですか?これは可能ですか?