Tag: prototypejs

Prototype或JQuery可以在AJAX请求上返回HTTP状态代码

url = “http://example.com” new Ajax.Request(url, { onComplete: function(transport) { alert(transport.status); } }); 我希望如果网站正常工作则返回200状态,如果不工作则返回500等等。但是该代码一直返回0。 最终,我希望有一个setinterval函数,定期ping一个网站的正常运行时间状态。

jQuery和prototype.js冲突,如何将jQuery保持为$?

所以我正在开发一个同时使用jQuery和prototype.js的网站,但是它们存在冲突。 我研究了一下,发现人们解决这个问题的唯一方法是使用 jQuery.noConflict(); // Use jQuery via jQuery(…) jQuery(document).ready(function(){ jQuery(\”div\”).hide(); }); // Use Prototype with $(…), etc. $(‘someid’).hide(); 但是我不想将$更改为jQuery,因为这意味着我必须编辑一些预先编写的代码。 有没有办法阻止它们冲突并将jQuery保留为$?

原型/ Mootools冲突问题

所以我有一个使用Prototype和Mootools AJAX脚本的页面。 还有更多的Mootools Prototype,所以我想知道Prototype是否有类似jQuery的函数$j = jQuery.noConflict(); 我可以用来重新定义Prototype的$别名? 谢谢!

您将如何将站点从Prototype切换到jQuery

我在Prototype中编写了一个站点,但想切换到jQuery。 有关如何最佳切换的任何想法?

覆盖“this”变量问题或如何调用成员函数?

我有这个类,我使用jQuery和Prototype的组合: var MyClass = Class.create({ initElements: function(sumEl) { this.sumEl = sumEl; sumEl.keyup(this.updateSumHandler); }, updateSumHandler: function(event) { // Throws error here: “this.updateSum is not a function” this.updateSum(); }, updateSum: function() { // does something here } }); 我怎么能调用this.updateSum()呢?

从原型转换为jquery

我正在尝试从一个从mysql数据库获取数据的php文件中对div进行简单的ajax更新。 一个函数填充div,另一个函数将消息添加到数据库,并在单击提交按钮时调用。 我想知道是否有人可以在jquery中给我他们的等价物。 以下是原型版本。 function getMessages(){ new Ajax.Updater(‘chat’,’messages.php’, { onSuccess:function(){ window.setTimeout( getMessages, 3000 ); } }); } getMessages(); function addmessage(){ new Ajax.Updater(‘chat’,’add.php’,{ method:’post’, parameters: $(‘chatmessage’).serialize(), onSuccess: function() { $(‘messagetext’).value = ”; } }); }

jQuery比其他JavaScript库有什么优势?

我试图说服那些在我现在的组织中设定标准的人,我们应该使用jQuery而不是Prototype和/或YUI。 我可以用什么令人信服的优势来说服他们?

使用jQuery Rails observe_field

有没有jRails使用jQuery的Rails / Prototype observe_field方法? 我正在使用will_paginate进行搜索: 2, :update =>’results’, :loading =>“Element.show(’spinner’)”, :complete =>“Element.hide(’spinner’)”, :url => {:controller =>’foo’,:action =>’search’}, :with =>“’search =’+ escape(value)”)%>

magento使用jquery与noconflict

我正在为我的Magento商店使用2个jquery脚本。 其中一个脚本,滑块完美运行,另一个不起作用。 jQuery.noConflict();jQuery(function($){ function mycarousel_initCallback(carousel) { // Disable autoscrolling if the user clicks the prev or next button. carousel.buttonNext.bind(‘click’, function() { carousel.startAuto(0); }); carousel.buttonPrev.bind(‘click’, function() { carousel.startAuto(0); }); // Pause autoscrolling if the user moves with the cursor over the clip. carousel.clip.hover(function() { carousel.stopAuto(); }, function() { carousel.startAuto(); }); }; jQuery(document).ready(function() { jQuery(‘#mycarousel’).jcarousel({ auto: 0, […]

触摸设备,单击和双击事件处理程序jQuery / Javascript?

背景: 我的网站是magento开源电子商务解决方案,在顶部(标题)它有一个购物车图标。 在dekstop上,当用户将鼠标hover在该图标上时,它会显示购物车中的内容(项目)。 但是点击该图标,用户可以访问购物车页面。 我想要: 我希望只有触摸设备才有能力,当用户单击图标时,它应该只显示内容,但是当双击图标时,它应该将它们带到购物车页面。 HTML代码:   My Bag (1) $28   我已经尝试过的: jQuery(function($){ /* Code to detect the user agent, if mobile device then execute the code*/ if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { // on single touch $(“#mini-cart .dropdown-toggle”).on(‘click’, ‘a’, function(e){ e.preventDefault(); $(“#mini-cart .dropdown-menu”).show(); }); // on double touch $(“#mini-cart .feature-icon-hover”).find(‘a’).dblclick(function(e){ location.href = ‘/checkout/cart’; //alert(‘dblclick’); […]