I’m trying to get a ‘loading’ div for my ajaxified website.
using JSF 2.0’s f:ajax tag for adding ajax to the website and ‘trying’ to make the loadin div show using jQuery $(document).ajaxStart function.
The jQuery code part looks like this:
$(document).ajaxStart(function(){
console.log("ajax start");
$('#ajaxBusy').show();
}).ajaxStop(function(){
console.log("ajax end");
$('#ajaxBusy').hide();
});
The log functions are never called.
Any Idea why? Do JSF ajax and javascript ajax not work together?
Thanks!
You should use
jsf.ajax.addOnEvent(callback)to display a loading div. MaybeaddOnErrortoo.See the documentation
You will need to work with
data.statusbegin: before the request is sentcomplete: request recievedsuccess: request succesfully processed (without errors)Examples using this api: