我在 django 的一个模板中使用了 jquery 对话框作为删除操作的确认,但问题是当我将数据发布到视图时,我invalid regular expression flag d
在调试 html 代码时得到了“”,问题出在这一行:
url : /certificates/delete/
这是我的代码:
模板 :
function openDialog(id){
$( "#dialog-confirm" ).dialog({
resizable: true,
height:140,
modal: true,
buttons: {
"Delete This Entry": function() {
$.ajax({
type: "POST",
url: {% url delete_id %},
data: {'id': id},
success: function() {
$( this ).dialog( "close" );
}
});
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
}
意见:
def delete_id(request):
id = request.POST.get('id', None)
网址:
url(r'^delete/', views.delete_id,name='delete_id')