I
I
Igor2017-03-14 21:19:03
PHP
Igor, 2017-03-14 21:19:03

How to refresh a page that is rendered in php when a button is clicked?

I'm trying to create my first Drupal site... On the
left of the page there is a table of links that set the id parameter, for example, from the "site" page we get to "site/?id=1", "site/?id=2", "site/ ?id=3" and so on. It is necessary when clicking on these links, in accordance with the parameter, to update the part of the page on the right, i.e. so that the same php script that forms the block starts again. It feels like php is only running once.
How to make an update?
PS Reading with $_GET('ID') works.. You have to force the php script to execute again...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Shamsudin Serderov, 2017-03-14
@Steein

(function($)
{
    $(document).ready(function()
    {
        $.ajaxSetup(
        {
            cache: false,
            beforeSend: function() {
                $('#content').hide();
                $('#loading').show();
            },
            complete: function() {
                $('#loading').hide();
                $('#content').show();
            },
            success: function() {
                $('#loading').hide();
                $('#content').show();
            }
        });
        var $container = $("#content");
        $container.load("file.php");
        var refreshId = setInterval(function()
        {
            $container.load('file.php');
        }, 9000);
    });
})(jQuery);

Auto-update the file every 9c (I understand you correctly, do you need the php file to be automatically updated?)

S
Stanislav, 2017-03-14
@ExcluZZ

Turn off block caching, maybe this is the case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question