0

Here is the description of my issue:

I have a db connection here:

$host = 'some host credentials';
$dbh = 'My database';

Here is my statement:

$qry = "SELECT some_data FROM some_table LIMIT 1000";
$result = some code here;

Here is my while loop:

echo '<table class="table table-striped table-hover table-bordered" id="example">
<thead>
    <tr  class="test">
        <th style="border: 1px solid #333;">PRODUCTPRICE</th>
        <th>PRODUCTNAME</th>
        <th>PRODUCTCODE</th>
        <th>PRODUCTSALE</th>
        <th>PRODUCTPRICE</th>
    </tr>
</thead>
<tbody>';

while ($row = mysql_fetch_assoc($result)){

$PRODUCTID = intval($row["PRODUCTID"]);
$PRODUCTNAME = $row["PRODUCTNAME_1"];
$PRODUCTCODE = $row["PRODUCTCODE"];
$PRODUCTSALE = $row["PRODUCTSALE_"];
$PRODUCTPRICE = $row["PRODUCTPRICE"];


    echo '<tr class="odd gradeX">
        <td>'.$PRODUCTID.'</td>
        <td>'.$PRODUCTNAME.'</td>
        <td>'.$PRODUCTCODE.'</td>
        <td class="center">'.$PRODUCTSALE.'</td>
        <td class="center">'.$PRODUCTPRICE.'</td>
    </tr>';


}

echo '</tbody>
</table></div>
</div>
</body>
</html>';

I want to make a loader before this content table display because there are more than 50,000 products. Something kind of processing or a circle showing that a content is loading, just a simple one, maybe jQuery or ajax. I have tried many tutorials till now but no success.

1 Answer 1

1

here is a scheme for that :

<div id="content"></div>
$.ajax({
    url : 'the-above-script.php',
    beforeSend : function() {
        $("#content").html('<img src="ajax-icon-from-www.ajaxload.info">');
    },
    success : function(html) {
        $("#content").html(html);
    }
}); 
Sign up to request clarification or add additional context in comments.

1 Comment

Yep! That was the one bro :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.