Prev | Current Page 125 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"


The view
As we have come to expect, the view (index.phtml) contains the HTML code for the page. This is the same as
before except that we have to qualify where to find the JavaScript files using the baseUrl property that we
created in indexAction:



In this case, I??™ve chosen to use the YUI for the Ajax request, but Prototype would have worked just as
well. The check() function also needs changing as we need a fully qualified URL for the request back to the
server. We therefore pass the base URL property to the check() and rework the JavaScript sUrl variable to be
in the Zend Framework format of controller/action/param_name/param_value as shown in Listing 4.7.
Listing 4.7: The URL in the Ajax request back to our server needs to be in the correct format
function check(baseUrl, name)
{
var sUrl = baseUrl + "/index/ajax/name/" + name;
var callback =
{
success: handleSuccess,
failure: handleFailure,
};
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.


Pages:
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
Poker strategia hologram totolotek torba do notebooka kreator www