Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

var SyncleonAJAX = new Class( {

	/**
	 * Initializes the class, and sets properties.
	 */
	initialize : function(url) {
		this.url = url;
		this.list = $('todo');
		this.details = $('todo-details');
	},

	/**
	 * Attaches the event to the list.
	 */
	attachEvents : function() {
		this.list.addEvent('change', this.getDetails.bind(this));
	},

	/**
	 * Retrieves the data from the Joomla model using a HTTP call.
	 */
	getDetails : function() {
		var id = this.list.getProperty('value');
		var details = this.details;

		var request = new Json.Remote(this.url + "&id=" + id, {
			onComplete : function(todo) {
				details.setHTML(todo.body);
			}
		}).send();
	}

});