我不断得到
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/