
Untitled
By: a guest on
May 1st, 2012 | syntax:
None | size: 0.92 KB | hits: 13 | expires: Never
loader for very large HTML content retrieved by jquery
$("#offerForm").submit(function() {
//show loader
$('#demo').append('<div id="zloader" style="background: #fff url('preloader2.gif') no-repeat scroll 10px center;
padding-left: 40px;">Loading, please wait...</div>');
//post the form
$.post('getoffers.php', $("#offerForm").serialize()
+ '&page=' + page, function(data) {
//show the returned data
$('#demo').html(data.htmlOutput);
}
}
$.post('<url>', {<data>}, function (data) {
$('#demo').append(data.htmlOutput).find('#zloader').remove();
});
$.ajax({
url: 'get-offers.php',
type: 'POST',
beforeSend: function () {
// append the loader
},
success: function( data ) {
// show the returned data
}
});
$.ajax{
...
success:function(){
// Show new content
// Hide loader
}}