Share on Google+Share on Google+

ZF Ajax Setup

In this tutorial we will study how to setup ajax(jQuery) and ZF. This tutorial also discussed Ajax in brief.

ZF and Ajax:

We assume that you have a fair knowledge over Ajax but let's have a quick look:

As we all know that Ajax is an acronym for Asynchronous JavaScript and XML.

Asynchronous: A website which is developed in Ajax, use the XMLHttpRequest object.

JavaScript:  The key component in Ajax technology is JavaScript and the browser's DOM (Document Object Model). DOM is a standardize way to represent the web elements in a tree form and JavaScript can access those elements.

XML: XML helps us to send data from the server to the browser within an asynchronous request. XML is used to format the data.

General use of Ajax are as follows:

  1. Form Validation
  2. Auto completion
  3. Auto drop-down list
  4. Dragging and dropping of items on the page

Since this tutorial is based on ZF 1.10, we will demonstrate the examples based on jQuery, now let's discuss on this topic:

ZF version 1.7 integrates jQuery view and it offers the following features:

  •  jQuery (core and UI) environment.
  • Zend_View helpers through jQuery UI.
  • Zend_Form elements and decorators through jQuery UI.

The jQuery JavaScript dependencies are loaded from the Google Ajax Library Content Distribution Network or CDN. In CDN we get both jQuery Core and jQuery UI access points.

jQuery related View Helpers can be accessed through ZF's extra libray. There are two ways to enable this helper, either add the following line to the view helper path:

$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");

or use ZendX_JQuery::enableView(Zend_View_Interface $view) method.



Posted on: April 28, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null