02 October 2009

0 AJAX Tutorial onComplete event of Ajax Updater

AJAX Tutorial - Tips1 - onComplete event of Ajax.Updater

How to ensure that a function or action is called only after the successful execution of the AJAX call ?

Ajax updater has onComplete callback, which will be executed after the successful execution of the AJAX call. This will help to prevent AJAX updater success action before the successful execution of the AJAX call.

new Ajax.Updater('searchResults', 'items/seachItems.html', {
      parameters: {
            searchTerm: p_searchTerm,
            searchTermValues: p_searchTermValues,
            pageIndex :p_pageIndex,
            startIndex : p_startindex,
            endIndex :p_endIndex
      },
      onComplete : function updateValues(){
            updateValues1(p_startindex,p_endIndex,p_pageIndex);
      }
});
On the Event "onComplete", the function "updateValues()" will be executed, which in turn can call any function in the script.


0 comments:

Feeds Comments

Please give your valuable comments.