This has been bugging me as well.
Have almost tried all.. finally... if I excluded my $.changePage the spinner would load, so far so good, I presumed that the $.mobile.loading would be triggered from a $.ajax call automatically and hide itself based on the ajaxStart/ajaxStop, and that changePage will also be prevented from executing/changing. This is not working in 1.2.x - changePage ignores this totally. So for now one would not have to do this on every ajax call:
$('foo').live("click", function() {
ajax_call(some_var);
$(document).ajaxStop(function() {
$.mobile.changePage("#menulist", { transition: "pop"} );
$.mobile.loading('hide'); // gives the changePage time to complete the enhancements
And in mobileinit:
$(document).ajaxStart(function() {
$.mobile.loading('show');
});
// ajaxStop is totally ignored by changePage() so pointless...
$(document).ajaxStop(function() {
$.mobile.loading('hide');
});
@
zoulou2356, I am using a multipage, make a dummy page before you real main page.. then changePage to that page when the ajaxStop is triggered...
T