javascript - 未捕获的类型错误 : Cannot read property 'msie' of undefined is the error

标签 javascript couchdb

我不断得到

Uncaught TypeError: Cannot read property 'msie' of undefined

当我尝试从 couchdb 控制台记录一个 View 时。我是编码新手,我不知道这个错误是什么意思。当我使用 ajax 调用基本上做同样的事情时,它会工作并从我的沙发数据库中提取 View 。这是给学校的,所以我需要让沙发电话正常工作。感谢您的帮助。

HTML:

<html>

<head>
    <title>SK8
        TEAMS</title>
    <meta charset="utf-8"/>

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="css/jquery.mobile.flatui.css"/>
    <script src="jquery-1.9.1.min.js"></script>
    <script src="jquery.mobile-1.3.2.min.js"></script>
    <link rel="stylesheet" href="style/main.css"/>
</head>

<body>

    <section data-role="page" id="home" data-theme="c">
         <section data-role="header" data-position="fixed">
            <h1>Home</h1>
            </section>
            <section data-role="content" class="ui-body-c">
                <ul id="homeItems" data-role="listview">
                </ul>
             </section>
         </section>

     <script src="jquery.couch.js"></script>
     <script src="my.js" type="text/javascript"></script>
</body>

JavaScript:

$(document).on('pageinit', '#home',
    function () {
        $.couch.db("sk8team").view("app/company", {
            success: function (data) {
                console.log(data);
            }
        });
    });

最佳答案

我也有类似的错误,不过我解决了。这是我从 Stack Overflow 获得的一段代码。只需将其粘贴到您的脚本中即可。并下载最新版本的 jQuery。我使用了 jquery-1.10.2.js。

JavaScript:

 jQuery.browser = {};
 (function () {
    jQuery.browser.msie = false;
    jQuery.browser.version = 0;
    if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
       jQuery.browser.msie = true;
       jQuery.browser.version = RegExp.$1;
  }
 })();

关于javascript - 未捕获的类型错误 : Cannot read property 'msie' of undefined is the error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18117930/

相关文章:

javascript - 从 Alloy UI 数据表创建 JSON

couchdb - 为什么require_valid_user参数一直提示用户认证?

JavaScript mouseover 和 mouseleave 事件

javascript - 每个Tableviewrow之间的空间钛合金

javascript - 将 couchdb 复制过滤器从 javascript 翻译为 erlang

java - CouchBase 与 Memcached 混合,失去了大多数 CouchDB 理念和功能?

python - 用于简单 python 应用程序的传统 SQL 与 MongoDB/CouchDB

couchdb - 如何为以下情况设计 couchdb View ?

javascript - Lodash 在尝试使用未定义的属性进行过滤时排除项目

javascript - 在美元符号之间渲染 LaTeX,就像 math.SE 所做的那样