1
我在Visual Studio中使用PhoneGap初学者模板设置了一个全新的项目。该模板按预期工作,但如果我尝试将jquery移动添加到页面中,并从中调用一个函数,则会报告jQuery未定义。PhoneGap&Visual Studio不复制脚本文件
这里是我的模板的javascript:
<script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script>
<script type="text/javascript" src="jquery.mobile.min.js"></script>
<script type="text/javascript">
document.addEventListener("deviceready",onDeviceReady,false);
// once the device ready event fires, you can safely do your thing! -jm
function onDeviceReady()
{
document.getElementById("welcomeMsg").innerHTML += "Cordova is ready! version=" + window.device.cordova;
console.log("onDeviceReady. You should see this message in Visual Studio's output window.");
jQuery("#welcomeMsg").html("blah");
}
</script>
我CordovaSourceDictionary.xml看起来是也没关系:
<?xml version="1.0" encoding="utf-8"?>
<!-- This file is auto-generated, do not edit! -jm -->
<CordovaSourceDictionary>
<FilePath Value="www\cordova-1.5.0.js"/>
<FilePath Value="www\index.html"/>
<FilePath Value="www\jquery.mobile.min.js"/>
<FilePath Value="www\master.css"/>
</CordovaSourceDictionary>
但在尝试调试的WP7应用程序,我得到这些错误:
ScriptNotify :: Error:"'jQuery' is undefined"
Log:"Error in success callback: Connection1 = 'jQuery' is undefined"
谢谢!通过这个小事实吹倒。 – 2012-03-29 20:11:35