Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7930097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:18:31+00:00 2026-06-03T20:18:31+00:00

I have a button set up to refresh a certain div when it’s clicked.

  • 0

I have a button set up to refresh a certain div when it’s clicked. Problem is that it only works once.

The div that I need refreshing when the button is clicked:

<div id="refresh">

    <?php include('space.php'); ?>

</div>

The script to refresh the div:

jQuery(function() {
    jQuery("#go").click(function() {
        jQuery("#refresh").load("space.php");
    });
});

and the contents of space.php:

 <?php

    /* get disk space free (in bytes) */
    $df = disk_free_space("/home");
    /* and get disk space total (in bytes)  */
    $dt = disk_total_space("/home");
    /* now we calculate the disk space used (in bytes) */
    $du = $dt - $df;
    /* percentage of disk used - this will be used to also set the width % of the progress bar */
    $dp = sprintf('%.2f',($du / $dt) * 100);

    /* and we formate the size from bytes to MB, GB, etc. */
    $df = formatSize($df);
    $du = formatSize($du);
    $dt = formatSize($dt);

    function formatSize( $bytes )
    {
            $types = array( 'B', 'KB', 'MB', 'GB', 'TB' );
            for( $i = 0; $bytes >= 1024 && $i < ( count( $types ) -1 ); $bytes /= 1024, $i++ );
                    return( round( $bytes, 2 ) . " " . $types[$i] );
    }

    ?>



        <table class='ipb_table' cellspacing='1'>  

                <tr>

                    <td class='row2' colspan='2'>

                        <div class='progress'>

                                <div class='prgbar'></div>

                        </div>

                    </td>

                <tr>


                    <td class='row2'>

                        Disk Space:

                    </td>


                    <td class='row2'>

                        <?php echo "$dt"; ?>

                    </td>

                </tr>

                <tr>

                    <td class='row2'>

                        Free: 

                    </td>

                    <td class='row2'>

                        <?php echo "$df"; ?>

                    </td>

                </tr>

                <tr>

                    <td class='row2'>

                        Used:

                    </td>

                    <td class='row2'>

                        <?php echo "$du"; ?>

                    </td>

                </tr>

                <tr>

                    <td class='row2' colspan='2' align='center'>

<a class='ipsButton' id='go'>Refresh<a>

                    </td>

                </tr>                           

        </table>   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:18:33+00:00Added an answer on June 3, 2026 at 8:18 pm

    Remove <?php include('space.php'); ?>
    Jquery is fine.Test this out

        jQuery(function() {
        var i=1;
        jQuery("#go").click(function() {
            jQuery("#refresh").html(i);
            i++;
        });
    });​
    

    jSfiddle

    Make sure space.php is on the same server. And second thing is that .load is not the replace of php include. Do this with jQuery Ajax

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a repeating alarm set, my problem is that after cancelling it doesn't
I have an MVC application that I need to countdown a certain number of
I have a view that contain a image i want to set a button
I have an EditText and a Button set next to each other on the
All right so I tried using the button set. So fair, I have been
In my hello world application, i have a button and a text field set
I have a login window with a Sign In button which is set as
I have created a button in my Android application & I tried to set
I currently have my code set to disable the submit button when the field
I have butons which are created dynamically, each button has an id set in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.