Update Content After Certain Time using jQuery,Ajax and PHP

Some content updates may be based on time the user information for the current user, other updates may be based on requests performed by any user, such as information based on a search performed by the Web-site visitor. You may also like Mysql UPDATE Statement using Join Statement.

HTML and jQuery Code

         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

        <div id="quote_box">
            <p id="quote">Please Wait</p>
    <script type="text/javascript">
        $(document).ready(function() {
            $.ajaxSetup({ cache: false }); 

        function fetch_quotes()
            type: 'post',
            url: 'get_content.php',
            data: {
                success: function (response) {
                    document.getElementById("quote").innerHTML = '"' + response + '"';

PHP Code (get_content.php)

if (isset($_POST['get_quote'])) {
    $quote = array(

    $total = count($quote) - 1;
    $var = mt_rand(0, $total);
    echo $quote[$var];

Leave a Reply

Your email address will not be published. Required fields are marked *