O'Reilly logo

Liferay User Interface Development by Frank Yu, Xinsheng Chen, Jonas X. Yuan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Ajax in Alloy UI

You may still remember Ajax calls with jQuery in Chapter 6, Portlet User Interface. In this section, we make Ajax calls using Alloy UI API. Let us look at some code first:

<% ResourceURL rURL = renderResponse.createResourceURL(); %> // ignore details AUI().ready('aui-io-request', function(A) { // ignore details var io = A.io.request( '<%= rURL.toString() %>', { autoLoad: false, cache: false, on: { start: function(event, id) { log('-'); log(this.get('uri')); log('start'); }, success: function(event, id, xhr) { var data = this.get('responseData'); var out = (dataType.val() == 'json') ? A.JSON.stringify(data) : data; log('success: ' + out); }, complete: function(event, id, xhr) { log('complete'); }, failure: function(event, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required