I have a page that executes an ajax request to the server. the server returns the "row table" html code, then I put this code in the table.
here is an example server response
<tr> <td>This is a cell</td> <td>this is a second cell</td> <td>this is a third cell</td> </tr>
On my page, when I want to download the results returned from the server, I have this code
<table id="main"> <tbody id="results"> </tbody> </table>
this is an example of my jquery
$(function(){ $('#results').html(''); $.getJSON("ajax/loader-display-previos-calls.php", { account_id: <?php echo $account_id; ?> },function (data) { if ( ! data) return; $('#results').html(data.msg); } ).done( function(){ $('.sub_note').shorten({ moreText: 'read more', lessText: 'read less', showChars: '100' }); }); });
What I'm trying to do here is show the loading icon on top of an existing table. I'm looking for 1) put a transparent block to cover the whole table 2) put a download icon in the middle of this transparent block.
I tried this
$('#results').html('<img src="images/ajaxSpinner.gif" alt="please wait..." style="width: 100px; position: absolute; left: 50%; top: 50%; margin-left: -50px; margin-top: -50px;display: block;"/>');
The spinner icon appears in the center of the page.
Basically I want to show the current results using the download icon until the server sends a request.
How can I make the table and its contents transparent and then put the download icon in the center?
source share