2014-06-19 7 views
1

我已经使用最新的Bootstrap.css/js构建了一个Ember.JS应用程序样式。在我的其中一个模板中,我有一个按钮触发禁用按钮的动作,并将其文本设置为通过描述here的引导功能“加载”。我从访问使用jQuery的按键我的行动中,如下所示:通过jQuery的Phonegap + Ember + jQuery + Bootstrap访问按钮?

$('.find').button('loading'); //Starts "Please Wait" message 

此运行余烬应用我的桌面上一台服务器时,伟大的工作。但是,我目前正在尝试将应用程序打包到iOS中的Phonegapp应用程序中。每当动作大火在模拟器中,我得到以下错误:

enter image description here

我开始怀疑这可能是由于我的行动的触发按钮不是通过使用jQuery类像在桌面上访问?但我并不十分确定这是我的第一个Phonegap应用程序。非常感谢有人能够澄清这一点。

回答

1

Got it!这是通过在this question上的答案解决的。

I don't think that JQuery is being loaded into the page.

You have referenced it as:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">

which says use whatever protocol the current page is being server from. On a mobile device you are being served from file:// so the actual request the browser makes to fetch the script is:

file://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js

You need to specify the scheme you want to use or else include it in the PG project itself.

与我一起,这不是我的jQuery没有被加载,而是我的Bootstrap.js!当您按照引导程序网站上的CDN说明进行操作时,URL的格式与“//”(称为“protocol-relative URL”或“网络路径引用”)相似,而不是显式的“http://”。做出改变解决了问题!

+0

“当你从引导网站获得它”咦?你什么意思?我们通常在网站上使用HTTPS ... – cvrebert

+0

对不起,应该是更具体的,我的意思是当你按照他们的'入门'指南:http://getbootstrap.com/getting-started/ –