Solved

Magento and JQuery(AJAX)

Posted on 2009-07-10
4
3,952 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

710 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