I use this function on all my site ajax calls. My question is how would you rewrite it to have a proper pre-load image since mine is kind of a cheat and if the page takes too long to load or is 404 that loading image never goes away.
function ajaxcall(my_url, my_div, my_data) { $(my_div).append('<div style="text-align:center; position:absolute; top:0; left:0; width:100%;"><img src="/images/loading.gif" /></div>'); $.ajax({ url: my_url, data: my_data, type: 'get', success: function(output) { $(my_div).html(output); } }); } Regards