Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/425.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
Javascript 插件未从控制台运行:无法执行';警报';未定义的_Javascript_Cordova - Fatal编程技术网

Javascript 插件未从控制台运行:无法执行';警报';未定义的

Javascript 插件未从控制台运行:无法执行';警报';未定义的,javascript,cordova,Javascript,Cordova,我已经为cordova安装了diaglog插件。当我运行它时,我得到一个错误,上面写着“无法调用未定义的'alert'方法” 当我从控制台执行相同的函数时,它运行得非常好 这是我的index.html文件: <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="co

我已经为cordova安装了diaglog插件。当我运行它时,我得到一个错误,上面写着“无法调用未定义的'alert'方法”

当我从控制台执行相同的函数时,它运行得非常好

这是我的index.html文件:

<html>
  <head>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    <script type="text/javascript" src="plugins/org.apache.cordova.dialogs/www/notification.js"></script>
    <script type="text/javascript">
    $( document ).ready(function() {

        navigator.notification.alert( <--------------------- here!!
        'You are the winner!',  // message
        function(){

        },         // callback
        'Game Over',            // title
        'Done'                  // buttonName
        );

      });
    </script>
    <LINK rel="stylesheet" href="style.css" type="text/css"> 
  </head>
  <body >
    <div> hello world</div>
  </body>
</html>

$(文档).ready(函数(){

navigator.notification.alert(您需要等待

插件未在中初始化

$(document.ready()


文档加载->文档准备->cordova开始初始化->deviceready

您在哪里定义导航器/通知?非常感谢。我一读到第一行就马上明白了。再次感谢。