Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php refresh page

header("Refresh:0");
Comment

php refresh page without reloading

window.addEventListener('load', function()
{
    var xhr = null;

    getXmlHttpRequestObject = function()
    {
        if(!xhr)
        {               
            // Create a new XMLHttpRequest object 
            xhr = new XMLHttpRequest();
        }
        return xhr;
    };

    updateLiveData = function()
    {
        var now = new Date();
        // Date string is appended as a query with live data 
        // for not to use the cached version 
        var url = 'livefeed.txt?' + now.getTime();
        xhr = getXmlHttpRequestObject();
        xhr.onreadystatechange = evenHandler;
        // asynchronous requests
        xhr.open("GET", url, true);
        // Send the request over the network
        xhr.send(null);
    };

    updateLiveData();

    function evenHandler()
    {
        // Check response is ready or not
        if(xhr.readyState == 4 && xhr.status == 200)
        {
            dataDiv = document.getElementById('liveData');
            // Set current data text
            dataDiv.innerHTML = xhr.responseText;
            // Update the live data every 1 sec
            setTimeout(updateLiveData(), 1000);
        }
    }
});
Comment

how to refresh a php variable without reloading page

function data() {
        var ret = [];
        ret.push({
          y: 'Today',
          a: <?php echo $data; ?>
        });
      return ret;
    }

var graph = Morris.Bar({
        element: 'graph',
        data: data(),
        xkey: 'y',
        ykeys: ['a'],
        labels: ['random label']
    });

function update() {
      graph.setData(data());
    }

setInterval(update, 60000);
Comment

PREVIOUS NEXT
Code Example
Php :: laravel form request exists 
Php :: laravel load relationship 
Php :: laravel one to many relationship 
Php :: upload image to database laravel 8 
Php :: php into javascript 
Php :: How to Get Radio Button Value in PHP Without Submit 
Php :: sync laravel 
Php :: codeigniter 3 image upload 
Php :: SUM with Eloquent 
Php :: laravel download file change name 
Php :: find diiference in minutes un laravel 
Php :: Simple factory Design pattern in PHP 
Php :: cf7 remove p tags 
Php :: php variable inside mysql query 
Php :: how to add x-xss-protection header 
Php :: guarded and fillable in laravel 
Php :: Toaster switch Statement 
Php :: php strip url of all invalid characters 
Php :: doble quotes in csv export php 
Php :: laravel migration drop foreign keys 
Php :: how to removde product into shop loop via product id 
Php :: php timezone paris 
Php :: php date text in middle 
Php :: create model and migration laravel 
Php :: php location header not working 
Php :: text to sha256 converter in laravel 
Php :: Create fake users on click laravel 
Php :: check url parameter if not redirect wordpress 
Php :: livewire model array 
Php :: laravel collection nth method 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =