[英]Getting issue of Javascript TypeError while using window.sqlitePlugin.openDatabase method of Cordova SQLite Plugin
I'm using cordova-sqlite-plugin for maintaining a localdatabase for my application. 我正在使用cordova-sqlite-plugin来维护我的应用程序的本地数据库。 Below is my code:
以下是我的代码:
<script type="text/javascript" src="js/cordova.js"></script>
<script type="text/javascript">
alert("Running...")
document.addEventListener("deviceready",function(){
window.sqlitePlugin.openDatabase({
name: 'test.db',
iosDatabaseLocation: 'default'
}, function(db){
alert('Database Created');
});
</script>
}); });
Below is the screenshot of the error which I'm getting while running the same on xcode simulator 下面是我在xcode模拟器上运行时遇到的错误的屏幕截图
It will be a great help if anyone can suggest some best possible solution. 如果有人能提出一些最好的解决方案,这将是一个很大的帮助。
Need to add SQLitePlugin.js also in the HTML like this: 需要在HTML中添加SQLitePlugin.js,如下所示:
<script type="text/javascript" src="js/cordova.js"></script>
<script type="text/javascript" src="js/SQLitePlugin.js"></script>
SQLitePlugin.js can be found in www folder inside cordova-sqlite-storage plugin folder (cordova-sqlite-plugin->www->SQLitePlugin.js) SQLitePlugin.js可以在cordova-sqlite-storage插件文件夹里面的www文件夹中找到(cordova-sqlite-plugin-> www-> SQLitePlugin.js)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.