【问题标题】:how to add jquery script on zend framework如何在zend框架上添加jquery脚本
【发布时间】:2014-05-26 09:45:08
【问题描述】:

我想在我的 zendframework 项目中添加 jquery 脚本,这是我的布局。 phtml头部分

<?php 
$this->headMeta()->appendHttpEquiv(
'Content-Type', 'text/html;charset=utf-8');
$this->headTitle('ToDo APP')->setSeparator(' - ');

 echo $this->doctype(); ?>  
 <html xmlns="http://www.w3.org/1999/xhtml"> 
 <head>
 <?php echo $this->headMeta(); ?> 
 <?php echo $this->headLink()->appendStylesheet($this->baseUrl().'/css/style.css'); ?>
 <?php print $this->headScript()->appendFile($this->baseUrl().'/js/bootstrap.js')
 ->prependFile('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'); ?>
 </head>

我需要http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js 才能使用我的引导程序。 js文件,但它不工作请帮助如何正确地做到这一点 我的 css 和 js 文件夹也放在 public 文件夹中。

【问题讨论】:

  • 你为什么不直接把它包含在&lt;head&gt;中,就像&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;一样
  • 我刚才试过了,先生,但还是不行
  • 你试过 ZendX_JQuery View Helpers 吗? framework.zend.com/manual/1.12/en/zendx.jquery.view.html

标签: javascript php jquery ajax zend-framework


【解决方案1】:

方法一

你为什么不直接把这个包含在&lt;head&gt;like中

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

方法 2
下载此 jquery 文件并保存在您的 js 文件夹中,名称为 jquery.min.js

现在像您一样包含 bootstrap.js

<?php print $this->headScript()->appendFile($this->baseUrl().'/js/jquery.min.js'); ?>

【讨论】:

  • 我将脚本直接包含在 中,就像这样
【解决方案2】:

只需像这样将其嵌入到您的 html 中

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-02
    • 1970-01-01
    • 2016-08-18
    • 2023-04-04
    • 2015-06-04
    • 2011-01-21
    • 1970-01-01
    相关资源
    最近更新 更多