函数$(文件)。已经无法正常工作

时间:2015-10-02 17:31:32

标签: javascript jquery

当用jquery加载方法加载页面时,我想在div上加载一个html,但是它不起作用,我从firebug控制台得到这个错误

  

“ReferenceError:未定义dialog_forms”。

我认为jquery文件是corectly加载但是没有把它加载到“editor-place”div

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap -->
    <link href="http://localhost/esi3d/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="http://localhost/esi3d/bootstrap/js/bootstrap.min.js"></script>
    <script language='javascript' type='text/javascript' src="http://localhost/esi3d/js/action.js"></script>
    <link type="text/css" rel="stylesheet" href="http://localhost/esi3d/assets/grocery_crud/themes/flexigrid/css/flexigrid.css" />
    <link type="text/css" rel="stylesheet" href="http://localhost/esi3d/assets/grocery_crud/css/jquery_plugins/fancybox/jquery.fancybox.css" />
    <link type="text/css" rel="stylesheet" href="http://localhost/esi3d/assets/grocery_crud/css/ui/simple/jquery-ui-1.10.1.custom.min.css" />

    <script src="http://localhost/esi3d/assets/grocery_crud/js/jquery-1.11.1.min.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/js/jquery_plugins/jquery.noty.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/js/jquery_plugins/config/jquery.noty.config.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/js/common/lazyload-min.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/js/common/list.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/themes/flexigrid/js/cookies.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/themes/flexigrid/js/flexigrid.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/js/jquery_plugins/jquery.form.min.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/js/jquery_plugins/jquery.numeric.min.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/themes/flexigrid/js/jquery.printElement.min.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/js/jquery_plugins/jquery.fancybox-1.3.4.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/js/jquery_plugins/jquery.easing-1.3.pack.js"></script>
    <script src="http://localhost/esi3d/assets/grocery_crud/js/jquery_plugins/ui/jquery-ui-1.10.3.custom.min.js"></script>

<style type='text/css'>
body
{
    font-family: Arial;
    font-size: 14px;
}
a {
    color: blue;
    text-decoration: none;
    font-size: 14px;
}
a:hover
{
    text-decoration: underline;
}
</style>

<script>
function funcion_javascript(){
   alert ("Esto es javascript");
}
</script> 
</head><body>
<!-- Beginning header -->
    <nav class="navbar navbar-default navbar-static-top" role="navigation">
          <div class="container">
            <ul class="nav navbar-nav">
                <li><a href=http://localhost/esi3d/index.php/clase>Clases</a></li>
                <li><a href=http://localhost/esi3d/index.php/office>Despachos</a></li>
                <li><a href=http://localhost/esi3d/index.php/dependency>Otras dependencias</a></li>
                <li><a href=http://localhost/esi3d/index.php/extra>Extras</a></li>
                <li class="active"><a href=http://localhost/esi3d/index.php/editor>Editor</a></li>
                <li><a href=http://localhost/esi3d/index.php/user_admin>Administracion de usuario</a></li>
                <!--<li><button type="button" class="btn btn-default navbar-btn" onclick="go('user_admin/logout')">Cerrar sesión</button><li>-->
                <li>
                    <p class="navbar-btn">
                        <a href="http://localhost/esi3d/index.php/user_admin/logout"  class="btn btn-default" role="button">Cerrar sesión</a>
                     </p>
                </li>
            </ul>
          </div>
        </nav>
<!-- End of header-->

    <div id="editor-place">

    </div>
    <script type="text/javascript">
        $(document).ready(function(){
            $( "#editor-place" ).load( 'http://localhost/esi3d/application/editor/editor.html');
        });
    </script>
</body>
</html>

2 个答案:

答案 0 :(得分:0)

&#34; dialog_forms&#34;是一个jQuery UI对话框? 你正在初始化?

<script type="text/javascript">
$(document).ready(function(){
    $( "#editor-place" ).dialog();
    $( "#editor-place" ).load( 'http://localhost/esi3d/application/editor/editor.html');
    $( "#editor-place" ).dialog( "open" );
});

enter image description here

答案 1 :(得分:0)

检查控制台,可能是CROSS限制。 如果内容在本地页面中,请通过相对地址更改“ localhost”;

$( "#editor-place" ).load( '../editor/editor.html');