简体   繁体   English

在cakePHP中使用Jquery和AJAX

[英]using Jquery and AJAX in cakePHP

Is it posible to use the Jquery library and the AJAX libraries (prototype & aculo) together in CAKE-PHP? 在CAKE-PHP中可以同时使用Jquery库和AJAX库(原型和aculo)吗? is it going to cause compatibility issues? 会引起兼容性问题吗?

是的,有可能,请确保在使用jQuery库时将对jQuery使用no-conflict对象或使用jQuery而不是$

Yes, possible. 是的,可能。 Assuming you have prototype.js included in head, you can add this to your template where you need jquery to work: 假设您的头中包含了prototype.js,可以将其添加到需要jquery才能工作的模板中:

<?=$javascript->link('jquery-1.4.4.min'); ?>
<script>
jQuery.noConflict();
  jQuery(document).ready(function() {
     /* do something.. */
  }   

</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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