简体   繁体   中英

how to add jquery script on zend framework

I want to add jquery script on my zendframework project this is my layout. phtml header part

<?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>

I need http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js for me to be able to use my bootstrap. js file but its not working please help how to properly do it also my css and js folders are place in the public folder.

像这样简单地将其嵌入到您的html中

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

method-1

why don't you directly include this in <head> like

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

method-2
download this jquery file and save in your js folder with name of jquery.min.js

now include this like you include bootstrap.js

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM