林停留一週以來,我中了一千萬西班牙語和英語論壇媒體鏈接看...JavaScript不使用谷歌應用程序引擎我的本地工作
的事情是,JavaScript並沒有在我的本地工作時我從Google App Engine啓動我的網站。
如果我複製/粘貼所有的html,css和.js文件,然後從記事本++啓動瀏覽器完美地工作,但出於任何原因不能在GAE上工作,我不知道爲什麼。
的app.yaml的工作,因爲如果我寫在瀏覽器中:
http://localhost:8080/js/script.js
,然後出現的JavaScript代碼。
這裏是我的所有代碼:
HTML:
<script type="text/javascript" src="/js/jquery.js"</script>
<script type="text/javascript" src="/js/script.js"></script>
JS:
$(document).ready(function() {
$("#ingles").fadeOut(1000);
});
我的app.yaml:
application: juanmamorenoportfolio
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /stylesheets
static_dir: stylesheets
- url: /images
static_dir: static_files/images
- url: /js
static_dir: js
- url: .*
upload: templates/index.html
static_files: templates/index.html
libraries:
- name: webapp2
version: latest
- name: jinja2
version: latest
和我main.py(我懷疑這個問題應該在這裏):
import os
import webapp2
import jinja2
jinja_environment = jinja2.Environment(autoescape=True,
loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')))
class MainHandler(webapp2.RequestHandler):
def get(self):
template = jinja_environment.get_template('index.html')
self.response.out.write(template.render())
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
非常感謝!!
是您'jquery'文件正確引用?在頁面上有一個元素,並且'ingles'的'Id'? – Jack
瀏覽器控制檯中是否存在錯誤報告? – Pointy
瀏覽器控制檯沒有錯誤。 http:// localhost:8080/js/jquery.js也顯示js代碼,是的,有一個名爲「ingles」的元素 –