gpt4 book ai didi

javascript - 对话框未打开 ajax jquery MVC2 asp.net

转载 作者:行者123 更新时间:2023-11-28 08:41:58 26 4
gpt4 key购买 nike

删除对话框未打开我的代码查看:

 `<div id="dialog-confirm" title="Delete dialog" style="display: none;">
<p>
Are you sure you want to delete the point?
</p>
</div>`

JavaScript:

 `options += '<div onclick="editPoint(' + id + ')">Edit</div>
<div onclick="deletePoint(' + id + ')">Delete</div>';
optionsBox.html(options);`

Controller : 公共(public)字符串delete_marker(字符串Id) { 尝试 { mapmaker_dbDataContext DB = new mapmaker_dbDataContext(); DB.SP_DeletePoint ( Id,/"Innayat"/User.Identity.Name ); return "点删除成功"; } catch(异常除外) { return "删除操作失败"; } }

删除功能:

function deletePoint(id) {

MapScript.removeOptionsBox();
$( "#dialog-confirm" ).css('display','block');
alert('in detele');
$( "#dialog-confirm" ).dialog({

resizable: false,
height:140,
modal: true,
buttons: {
"Delete": function() {
var link = '<%= Url.Action("delete_marker", "Home", new { id = "-1" }) %>';
link = link.replace("-1",id);
$.ajax({
url: link,
type: "GET",
cache: false,
success:
function (data) {
//alert(data);
if($('.up-triangle.firstAnimationA').length || $('.up-triangle.firstAnimationB').length )
//LoadList(0);
LoadNeighborhoodList(0, MapScript.neighborhoodCenter.latitude, MapScript.neighborhoodCenter.longitude);
if($('.up-triangle.secondAnimationA').length || $('.up-triangle.secondAnimationB').length )
//LoadList(1);
LoadNeighborhoodList(1, MapScript.neighborhoodCenter.latitude, MapScript.neighborhoodCenter.longitude);
if($('.up-triangle.thirdAnimationA').length || $('.up-triangle.thirdAnimationB').length )
{
//LoadList(2);
LoadNeighborhoodList(2, MapScript.neighborhoodCenter.latitude, MapScript.neighborhoodCenter.longitude);
}
},
error: function(){
alert('Delete operation failed');
}
});
$( this ).dialog( "close" );
$( "#dialog-confirm" ).css('display','none');
alert('delete button clicked');

},
"Cancel": function() {
$( this ).dialog( "close" );
$( "#dialog-confirm" ).css('display','none');
}
}
});
$( "#dialog-confirm" ).dialog();


}

它给出的错误代码有什么问题?即使我用警报替换 ajax 功能,它也会再次给出错误

最佳答案

在加载正文或文档上声明您的对话框 div,如下所示...

$(function() {

$( "#dialog-confirm" ).dialog({
autoOpen: false});


});

关于javascript - 对话框未打开 ajax jquery MVC2 asp.net,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20367864/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com