Ajax link success callback?

17 Dec '13, 01:14 PM
17,959 Views
Forum Forum Starter - Level 2

Hi,

When i model(ifml) a link i can set it as ajax link. There's an option to put 'On Failure Callback' but how do i capture success ajax call?

I'd like to have a callback when the ajax response has been recieved and new/refreshed dom tree has been constructed. I tried to put document ready ($(function(){<things_i_want_to_to>});) within the html returned by ajax request inside a Message component but such way it must be rendered after all other units returned by ajax which is difficult to control sometimes and also increases traffic.

Thanks.

 
x 0
Follow
Answer Answer at this question and get points!
Forum Expert - Level 5

Hi,

Webratio by default show a alert when ajax request failed.

Ajax funcionality of webratio use jquery. You can use Ajax events of JQuery.

See it on http://api.jquery.com/Ajax_Events/

In your style create a page, with code like this:

<script text="javascript/text">
$.ajax({
   ajaxError : function(){
     // Handle the beforeSend event
   },
 });
</script>

 

 
x 0
Forum Starter - Level 2

Hi,

Ok, i don't care much about failed request, i need success callback, and how do i access jQuery ajax when i have a link from the Form component set as ajax link in properties of that link? Or how do i call that link using jQuery if the generated code of the link is something like this:

<input title="Link title" onclick="return ajaxRequest('page1FormBean', $H({isForm: true, pressedLink: 'button:ln1', selectiveRefresh: true, sourcePage: 'page1'})) " class=" button"  id="button:ln1" name="button:ln1" type="submit" value="Submit">

Is there also a source code of wr.js available? (i only found minimized/obfuscated version).

 
x 0
Answer at this question and get points!