简体   繁体   English

单击表格行时的对话框

[英]Dialog box on click of table row

I am having a table in html I want that on click of a row a dialog box appears and for updating my database i made an ajax call somewhat like this : 我在html中有一个表,我希望在单击行时出现一个对话框,并且为了更新我的数据库,我进行了一个类似于以下的ajax调用:

$(document).ready(function() {
$('.myrow').click(function ()
    {
        $("#dialog").dialog({
            autoOpen: false,
            modal: true,
            width: 600,
            height: 300,
                            resizable: false,
            buttons: {
                "Yeah!": function() {
                    $(this).dialog("close");
                },
                "Sure, Why Not": function() {
                    $(this).dialog("close");
                }
                            }
        });

        $.ajax({

            type: "post",
            url: "shownotification.jsp", 
            data: {
                notifyidd: $(this).attr("id")


            },
            error : function(){ 
                alert('Error'); 
            },
            success: function(msg){      

                    alert('Success'); 

            }

        });
    });
});

But the dialog box is not appearing.Please help. 但是对话框没有出现,请帮忙。

In html i had made a divison for dialog box : 在html中,我对对话框做了一个划分:

<div id="dialog"></div>

I also included required js and css files. 我还包括必需的js和css文件。

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/ui-darkness/jquery-ui.css" rel="stylesheet">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>

But still no success.Please help 但仍然没有成功。请帮助

You have the auto open flag set to false. 您已将自动打开标志设置为false。 Try setting it to true. 尝试将其设置为true。 If you want to still use false, you have to call the .open() method. 如果仍要使用false,则必须调用.open()方法。

http://api.jqueryui.com/dialog/#option-autoOpen http://api.jqueryui.com/dialog/#option-autoOpen

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM