Can I include jQuery and AJAX in the same file? Would this conflict?

Can I include jQuery and AJAX in the same file? Would this conflict?

I am attempting to include jQuery with a Magento GO template, but when I upload and include jQuery in the template, the drop down menus/etc. stop working. The links all still work fine, but the dropdown menus, and other similar functionality stop working…

I believe this may be because Magento includes AJAX in the hosted solution on their end..?

3 thoughts on “Can I include jQuery and AJAX in the same file? Would this conflict?”

  1. No, using jQuery along with another library that uses AJAX does not cause any conflicts.

    What can cause a conflict is that the jQuery library uses the $ identifier. If the other code is also using that, they won’t work togehter unless you use the noConflict method in jQuery.

  2. Magento includes Prototype by default. It’s strongly recommended that you do NOT add jQuery unless it cannot be avoided. Pretty much any functionality that jQuery provides is also available in Prototype/Scriptaculous, it’s just not as popular (and/or well marketed) as jQuery.

    As the other answers have suggested, you need to put jQuery into noConflict mode. You will find that you might still encounter other issues, but it’s a start.

Leave a Reply

Your email address will not be published. Required fields are marked *