そのレコードを削除した後に div を非表示にする jQuery スクリプトがあります。ここにjQueryがあります。
$(document).ready(function () {
$(".deleteComment").click(function ()
{
alert("asd");
var Id = $(this).attr("id");
var url1 = "@Html.Raw(Url.Action("DeleteComment", "Comment", new { id = "idValue" }))";
url1=url1.replace("idValue",Id );
alert(url1);
$.ajax(
{
type: 'post',
url: '/Comment/DeleteComment',
dataType: 'json',
data:
{
'EId' : Id
},
success: function (data)
{
alert ("Hello");
var commentBlock = $(this).closest('div');
commentBlock.hide('slow');
}
});
問題は以下のコードのみです:
success: function (data)
{
alert ("Hello");
var commentBlock = $(this).closest('div');
commentBlock.hide('slow');
}
上記のコードをスクリプトの先頭に配置すると、正常に動作します。私が成功した場合、それは失敗します。