Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
母版页中的调用jquery对话框_Jquery_Html_Asp.net Mvc - Fatal编程技术网

母版页中的调用jquery对话框

母版页中的调用jquery对话框,jquery,html,asp.net-mvc,Jquery,Html,Asp.net Mvc,我使用MVCHaack.ajax通过javascript调用控制器函数。在调用函数之前,我会显示一个jquery对话框。当我在视图中使用它时,一切都很完美,但在母版页中,当我调用时,对话框显示为文本块,而不像对话框。这是我的母版页代码: <script src="/json/RequestVIP?json"></script> <script src="@Url.Content("~/Scripts/RequestVIP.js")" type

我使用MVCHaack.ajax通过javascript调用控制器函数。在调用函数之前,我会显示一个jquery对话框。当我在视图中使用它时,一切都很完美,但在母版页中,当我调用时,对话框显示为文本块,而不像对话框。这是我的母版页代码:

            <script src="/json/RequestVIP?json"></script>
<script src="@Url.Content("~/Scripts/RequestVIP.js")" type="text/javascript"></script>

<script type="text/javascript">
    $(function () {
        $('#vipdel').click(function () {
            $("#messagec").replaceWith("<span id=messagec>آیا از حذف عضویت ویژه مطمئن هستید؟</span>");
            $("#dialog-confirm").dialog({
                buttons: {
                    "بلی": function () {
                        $mvc.RequestVIP.Delete({ customerId: $("#hdnId").val() }).success(function (data) {
                            $("#messagec").replaceWith("<span id=messagec>" + data.message + "</span>");
                            $("#dialog-confirm").dialog({
                                buttons: {

                                    "تایید": function () {
                                        $(this).dialog("close");
                                    }
                                }
                            });

                            $("#dialog-confirm").dialog("open");
                        });
                    },
                    "خیر": function () {
                        $(this).dialog("close");
                    }
                }
            });

            $("#dialog-confirm").dialog("open");

            // alert(data.message);

        });
    });
</script>






 <div class="section">
                                <h2 class="title">• عضویت ویژه</h2>
                                            @Html.Hidden("hdnId", @User.Identity.Name.Trim())
                                <button style="width:150px;vertical-align:middle" id="vipreq"><img src="@Url.Content("~/images/join.png")"/>درخواست عضویت ویژه</button><br/>
                                <button style="width:150px;vertical-align:middle" id="vipdel"><img src="@Url.Content("~/images/deljoin.png")"/>حذف عضویت ویژه</button><br/>
                                <button style="width:150px;vertical-align:middle" id="viprev"><img src="@Url.Content("~/images/rejoin.png")"/>تمدید عضویت ویژه</button><br/>
                            </div>


   <div id="dialog-confirm" title="عضویت ویژه">
        <p>
            <span class="ui-icon ui-icon-alert" style="font-family: Tahoma; float: right; margin: 0 7px 20px 0;">
            </span><span id="messagec"></span>
        </p>
    </div>

$(函数(){
$('#vipdel')。单击(函数(){
$(“#messagec”)。替换为(“آ;
$(“#对话框确认”)。对话框({
按钮:{
“بلی”:函数(){
$mvc.RequestVIP.Delete({customerId:$(“#hdnId”).val()})。成功(函数(数据){
$(“#messagec”)。替换为(“+data.message+”);
$(“#对话框确认”)。对话框({
按钮:{
“تاید”:函数(){
$(此).dialog(“关闭”);
}
}
});
$(“对话框确认”)。对话框(“打开”);
});
},
“خیⅧ”:函数(){
$(此).dialog(“关闭”);
}
}
});
$(“对话框确认”)。对话框(“打开”);
//警报(数据、消息);
});
});
• عضویت ویژه
@Html.Hidden(“hdnId”,@User.Identity.Name.Trim())
د
حذعؾ۔۔ژه


布局页面中是否包含
jquery.ui
脚本和样式表?是。我包括了这两个元素,你可以通过浏览器检查器检查它们是否真的被加载并应用到对话框元素。问题解决了。我改变了这些线的位置。我将它们放在jquery定义之前。我将它们放在jquery定义之后,一切都正常。谢谢,换成什么了?也许它会帮助别人。