为什么浏览器无法识别jquery

时间:2010-03-22 09:15:27

标签: jquery google-app-engine httpwebrequest

浏览器无法使用Google App Engine提供的jquery.js作为SDK的page.html来识别

http:some_request源代码, BUT 当我将完全相同的 page.html直接从我的本地硬盘驱动器加载到浏览器中jquery.js一切正常,它已被识别,所以我知道我的路径没事......

page.html的标题中,我有以下内容:

<script src="/static/jquery.js" type="text/javascript"></script>

来自我的app.yaml:

- url: /static
  static_dir: static
  expiration: 1d

4 个答案:

答案 0 :(得分:1)

您是否在应用中上传了jquery.js并为其设置了static file handler

答案 1 :(得分:0)

第二次尝试这个

<script src="./static/jquery.js" type="text/javascript"></script>

仔细检查您的路径,并检查外部脚本的天气是否可用。

答案 2 :(得分:0)

或者您可以尝试将jQuery文件引用为

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>

答案 3 :(得分:0)

关键是您希望被客户端浏览器识别的所有文件jquery.js都应位于静态目录中 的目录中。

因此app.yaml文件中与此相关的部分应如下所示:

- url: /jquery
  static_dir: static/jquery


- url: /static
  static_dir: static
  expiration: 1d

我现在更改为使其工作的关键点是静态目录中的jquery内容:static_dir:static / jquery

所以现在在page.html的标题部分我有这个工作,所以我可以离线使用SDK:

<script type="text/javascript" src="/jquery/jquery.js" ></script>
<script type="text/javascript" src="/jquery/jquery.form.js" ></script>