Below code demonstrate how to use Ajax Call in your Liferay Code/Yahoo Code.
Example 2 : A Generic Method to Manage Your Ajax Calls
function ajaxPush(targetDiv, requestURL, postData, syncMode) {
A.use('aui-io-request', function(A) {
A.io.request(requestURL, {
method : 'POST',
cache: false,
dataType : 'html',
data : {
postKey : postData
},
sync : syncMode,
on : {
start : ajaxPushStartEventManager(targetDiv),
success : function() {
ajaxPushSuccessEventManager(targetDiv, this
.get('responseData'));
},
failure : function() {
ajaxPushFailureEventManager(targetDiv, this
.get('responseData'), requestURL);
}
}
});
});
}
Note : ajaxPushStartEventManager/ajaxPushSuccessEventManager/ajaxPushFailureEventManager These are callback methods and contains the start/success/failure of ajax call. Like in ajaxPushStartEventManager method you can put a loading Mask to the targetDiv and helps user to understand something is being loaded via ajax.
Thanks bibek, Today I was searching related to the sync ajax call using alloy ui. so found your blog.. good to see..