Javascript Uncaught TypeError:$(...)。dialog不是一个函数

时间:2016-10-17 09:04:41

标签: javascript jquery html

您好我在Javascript中面临一个非常常见的问题。错误是

A<float, (1,2,3)> a

但我无法理解为什么会这样。我已经包含了所有必要的文件。我会粘贴我的代码 -

HTML文件 -

Uncaught TypeError: $(...).dialog is not a function

这是我的JS文件,我正在检查会话是否无效。如果无效,那么它应该显示一个模态框,并且在该模态框中应该有一条消息,表明您已成功注销。

<head>
        <meta charset="utf-8">

        <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
        Remove this if you use the .htaccess -->
        <meta http-equiv="X-UA-Compatible" content="IE=11">

        <title>Landing Page</title>
        <meta name="description" content="">

        <meta name="viewport" content="width=device-width; initial-scale=1.0">

        <!--bootstrap-->
        <link rel="stylesheet" href="styles/bootstrap.min.css" />

        <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
        <link rel="shortcut icon" href="/favicon.ico">
        <link rel="apple-touch-icon" href="/apple-touch-icon.png">

        <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,300,400,700">
        <link rel="stylesheet" href="styles/checkhover.css" />
        <link rel="stylesheet" href="styles/jquery-ui.css" />
        <script type="text/javascript" src="scripts/jquery-3.1.0.min.js"></script>
        <script type="text/javascript" src= "scripts/bootstrap.min.js"</script>
        <script type="text/javascript" src="scripts/jquery-ui.js"></script>
        <script type="text/javascript" src= "scripts/urlSpecifier.js"></script>
        <script type="text/javascript" src= "scripts/landingPage.js"></script>
    </head>

    <body>
        <div class="except_footer">
            <img src="images/logo.png" class="logo"/>

            <!--<div class="user_info">
            <p class="uname" class="u_name">Username</p>

            <p class="logout"><a href="" class="link"> Out </a></p>
            </div>-->

            <!--test hover dropdown-->

            <div class="row row1">
                <div class="col-md-4 col-xs-2 col-md-offset-1 user_info">
                    <p id = "welcomeMsg" class="dropbtn">
                    </p>
                    <div id = "dropdown" class="dropdown-content">

                        <a href= "#" id = "refDataPageLink" onClick= refData() class="refDataLink">Manage Reference Data</a>
                        <br />
                        <a href= "#" onClick= openHelp() class="helpLink">Help</a>
                        <br />
                        <a href= "#" class="logoutLink" onclick=onLogout()>Log Out</a>
                        <br />
                    </div>
                </div>
            </div>

            <!--test hover dropdown-->
            <div class="row row2">
                <div class="col-md-2 col-xs-4 col-md-offset-3 A_page">
                    <button type = "button" id = "a_button" class="a_button custom" onClick = a() >A</button>
                </div>
                <div class="col-md-2 col-xs-3 col-md-offset-1 B_page">
                    <button type = "button" id = "b_button" class="b_button custom" onClick = b() >b</button>
                </div>
            </div>
            <!--modal box-->
        <div id="modelView" title="Warning!"> 
        </div>
        <!--modal box-->
        </div>
        <div class="footer_div">
            <div class="image">
                <p style="position: relative; right:0px; bottom: 0px;" class="footer_text"></p><img src="images/footer_logo.png" class="footer_img" style="position: relative;
                right: 0px;
                bottom: 0px;" />
            </div>
        </div>

    </body>

</html>

因此,如果我在回复“无效的会话ID传递”,那么我正在调用一个函数,它会给出一个模态框。

$.ajax({
                url : fullAuthUrl,
                dataType : 'text',
                crossOrigin : true,
                cache : false,
                type : 'GET',
                success : function(response) {
                    var responseBodyFull = response.replace(/^\s+|\s+$/g, '');
                    if (responseBodyFull == "Invalid Session Id passed") {
                            console.log("Invalid Session");
                            showModalBoxForInvalidSessionInfo();
                           }
                    console.log(responseBodyFull);
                    enableOrDisableLinks(responseBodyFull);
                }
            });

但在这里我得到了错误。我已查看链接,其中有相同的问题,但我已经包括JS文件,我首先是初始化拨号框,然后我也得到错误。

1 个答案:

答案 0 :(得分:1)

您需要为bootstrap js(bootstrap.min.js)添加结束括号。