Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3964
  • Last Modified:

Magento and JQuery(AJAX)

I am working on magento site, where I would like to use JQuery and AJAX as possible. I am using specific layout which is suitable for this.
Has anyone experience with Magento with JQuery (or AJAX in frontend) ? How much support is in Magento for AJAX / JSON? I mean frontend, not backend.
One way to implement ajax in frontend is learn from backend, and then try to do likewise.
I want some ajax api, for example ajax controller (something like zend ajaxController) which returns product info in JSON for some product ID etc.
      
In other words, is there something like "magento AJAX api" ?

Thanks for any suggestions
0
Michal-Drozd
Asked:
Michal-Drozd
  • 2
1 Solution
 
fiboCommented:
Hi Michal,

1 - Magento is using heavily javascript and Ajax both on front and back-end usually with scriptaculous/ prototype.

2 - Adding jQuery is possible, but you need to take care of interferences with the other libs.
You will find a complete explanation / example at
http://css-tricks.com/using-jquery-in-magneto/ (yes there is a typo... but this is really the link)

3 - A final note: in Magento you can "consolidate" most of the js files. This is an option you select in the site configuration.
BUT be aware that it works thru a php file and that create 2 problem /constraints:
a - the js can be consolidated only if they are under /js/
b- during Magento updates (once a month) the file /js/index.php maybe overwritten and get its ACCESS RIGHTS CHANGED to chmod 666 instead of 644... most host providers will refuse to run a php scripts with chmod 666, and you will be checking why your site does not work anymore...
0
 
fiboCommented:
AngelIII,
I believe my answer was relevant and useful.
I leave to Michal or you to evaluate this.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now