Was this review helpful to you?
onclick="new RF(1, id;?>, |#2
'baseUrl; ?>'); return false;">Yes |
onclick="new RF(0, id;?>,
'baseUrl; ?>'); return false;">No
<#1: Set the id of each element that we want to address using the format {label}-{review_id} >
<#2: Create a new instance of a request feedback object, RF. This object will intiate the Ajax connection in its constructor >
As you can see in listing 4.8, the HTML for the review feedback system consists of a message informing
the user of the helpfulness of the review, two links for providing feedback (Yes or No) and two place holders
for providing interactive responses after clicking a link. To make this HTML code useful for an Ajax
application we have to make each part easily accessible from Javascript. We do this by setting the id attribute
to a unique value using the review??™s database id. Now that we have a the HTML, we can add some JavaScript
to do the work.
4.5.2 Adding JavaScript to the View Templates
As the review feedback system uses Ajax, we will use the YUI framework for the behind the scenes
connection to the server.
Pages:
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141