GithubHelp home page GithubHelp logo

Comments (2)

SilverFire avatar SilverFire commented on August 24, 2024

Basic app template:

SiteController.php

diff --git a/controllers/SiteController.php b/controllers/SiteController.php
index 33f6227..4c497a8 100644
--- a/controllers/SiteController.php
+++ b/controllers/SiteController.php
@@ -95,6 +95,12 @@ class SiteController extends Controller
         ]);
     }

+    public function actionSleep()
+    {
+        sleep(3);
+        return $this->renderAjax('about');
+    }
+
     public function actionAbout()
     {
         return $this->render('about');

view about.php

diff --git a/views/site/about.php b/views/site/about.php
index 752342c..18220b9 100644
--- a/views/site/about.php
+++ b/views/site/about.php
@@ -17,4 +17,8 @@ $this->params['breadcrumbs'][] = $this->title;
     <?= Yii::t('app', 'ru-RU тест') ?>

     <code><?= __FILE__ ?></code>
+
+    <?php \yii\widgets\Pjax::begin(['timeout' => 3000]); ?>
+        <a href="/site/sleep">click</a>
+    <?php \yii\widgets\Pjax::end(); ?>
 </div>

This code works as expected: clicking on link triggers PJAX request, the client side waits 3 seconds waiting for the response, then navigates to /site/sleep URL with full page reload.
When I decrease sleep time in the controller action, PJAX loads the response without page reload.

How to reproduce the problem?

from jquery-pjax.

matperez avatar matperez commented on August 24, 2024

Sorry. It's my fault.

I've used $.pjax.reload to reload the container. Apparently it uses the default timeout value.

from jquery-pjax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.