prototype.message = function(class, text) {
document.getElementById('message-'+this.id).className = class;
document.getElementById('message-'+this.id).innerHTML = text;
}
The thank you message is displayed in the div with an id of message-{review_id} and the message
function just hides the verbosity of setting the CSS class and the text of the message that we need to display.
Two other helper functions, startSpinner() and stopSpinner() are needed also. To create a spinner, we use an
animated GIF image which is added to the HTML in startSpinner() and removed in stopSpinner():
RF.prototype.startSpinner = function() {
var spinner = document.getElementById('spinner-'+this.id);
var url = this.baseUrl+'/img/spinner.gif';
spinner.innerHTML = '

';
}
RF.prototype.stopSpinner = function() {
document.getElementById('spinner-'+this.id).innerHTML = "";
}
We can now define the success() call back function that does the real work, as shown in listing 4.10.
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
Listing 4.10: The success call back function
RF.prototype.success = function(o) {
if(o.responseText !== undefined) {
var json = eval("(" + o.
Pages:
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144