<script type="text/javascript">
#set($D = '$')
AJS.$(document).ready(function(){
AJS.${D}.ajax({}
AJS.${D}.ajax ({
success: function(data){
comment();
}
});
});
function comment(){
AJS.{D}.ajax({
alert("Message");
});
}
<script>
This doesnt execute any of the ajax if the third ajax the last one if implemented