Solved

Magento and JQuery(AJAX)

Posted on 2009-07-10
4
3,931 Views
Last Modified: 2013-12-13
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
Comment
Question by:Michal-Drozd
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
fibo earned 500 total points
ID: 24827643
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
 
LVL 29

Expert Comment

by:fibo
ID: 25010911
AngelIII,
I believe my answer was relevant and useful.
I leave to Michal or you to evaluate this.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now