pjax

how to hide spinner after the content loads

有些话、适合烂在心里 提交于 2021-01-29 11:15:56
问题 I'm using pjax to load content and while the content is loading, I show a spinner: $('a[data-pjax]').pjax().live ("click", function () { $("#loader").show(); }); This works fine, however, after the content loads the loader still stays there. Where should I call $(#loader).hide() to hide the loader after the content has loaded? 回答1: According to the doc https://github.com/defunkt/jquery-pjax $(document).on('pjax:complete', function() { $("#loader").hide() }) I think you can also use pjax:end

Yii2 - Update data by switch toogle using Ajax/Pjax in GridView

耗尽温柔 提交于 2020-01-06 07:58:13
问题 I want to update my data in GridView using Switch Toogle without refresh the current page. Here is the image: So I want to update the attribute status using the toogle switch like the image above. Here is my code: index.php <?= GridView::widget([ 'dataProvider' => $dataProvider, //'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], //'alumni_id', 'tahun_lulus', 'file_excel', [ 'attribute' => 'status', 'format' => 'raw', 'value' => function($data){ if($data-

Pjax with wordpress custom theme giving 301 error in firebug

梦想的初衷 提交于 2020-01-06 03:29:08
问题 I am trying to use pjax in wordpress . but whenever I try to click the link which fetches the content via ajax call , nothing happens and page loads normally, firebug console show 301 aborted error . Any one can help ? 回答1: if you are using ajax in wordpress then make the action in function.php file of your theam , like below example add_action('wp_ajax_do_ajax', 'our_ajax_function'); function our_ajax_function(){ // now we'll write what the server should do with our request here } Hope it

Is there any way to programmatically call and execute pjax from within my javascript file?

和自甴很熟 提交于 2020-01-03 15:55:33
问题 I have a function that waits for a user to click on an input of type text and then waits for the user to press the down and up arrow keys. When the user presses the down and up arrow keys the function hoverDown() is called which essentially programmatically hovers over tables rows. When enter is pressed, window.location is called and the appropriate page is loaded. The problem is that I'm using pjax throughout my application to dynamically load the content and push the new url without a page

Rails Refresh Page For All Users On Command

六月ゝ 毕业季﹏ 提交于 2020-01-03 06:45:08
问题 I'm looking to create a Rails application that will be used as programme that outlines the running order of a service / event for my local church. The basic concept is that the technical team who control the sound, lighting, visuals etc and the volunteers can log in to the application and view the running order which will contain all the elements of the service including timings etc. I want a producer to be able to control the running order, so that he / she has basically a 'Next' / 'Back'

Pjax animations

*爱你&永不变心* 提交于 2020-01-01 04:27:06
问题 I finally got pjax working, but I have another question.. How do I add some jquery animation like fadeout/slideup old content and fadein/slidedown new content? By default pjax just changes the content without any good looking effects.. Any help would be much appreciated. Best Regards 回答1: Basically, you have a bunch of events to latch on to and do as you like. Here's a basic fadeIn and fadeOut version using the pjax:start and pjax:end as triggers. $(document) .on('pjax:start', function() { $(

Yii2 Pjax GridView action buttons issue

99封情书 提交于 2019-12-31 02:08:26
问题 I am trying to make an Ajax GridView using Pjax. Everything is working fine except the view, update and delete buttons are not AJAX. The code is: <?php yii\widgets\Pjax::begin(['id' => 'demo']); ?> <?= GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], 'id', 'name', ['class' => 'yii\grid\ActionColumn'], ], ]); ?> <?php yii\widgets\Pjax::end(); ?> The problem is that the links for delete, view and update have the attribute data-pjax=0 which

Desperately need a solution for Adsense that works with Ajax

纵然是瞬间 提交于 2019-12-29 04:30:14
问题 I know this questions has been asked a few times here. But these seem fairly outdated, and it looks like the Adsense for Ajax project has been canned (or at the very least, moving very slowly). I have a web site that I've recently integrated pjax into -- basically, it uses Ajax to load the just the main content area, while maintaining the browser history and back/forward functionality using javascript's history.pushState .It has made a world of difference in how responsive the whole site is,

jquery-pjax遇到的坑

这一生的挚爱 提交于 2019-12-26 12:12:04
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 最近做的东西的前端部分,想模仿github之类的网站使用pjax技术,实现局部刷新并且更改浏览器地址。 于是我在github上搜索了一些个开源的pajx技术的实现,发现有个叫jquery-pjax的还不错,star也蛮多的。 我遇到了两个问题: 第一:在使用的过程中发现页面总是全局刷新跳转的 原因是,我写的每个页面都是完整的,比如,在浏览器中打开一个完整的页面,然后使用jquery-pjax,获取另一个完整的页面中的局部内容,一开始我是这样写的 document.pjax('a标签的选择器', '局部内容的标签的选择器') 我犯了两个错: 1.局部标签的选择器只能通过id取,class不行; 2.需要第三个参数,因为获取的页面是不完整的就没问题,但是我这里请求得到的是完整的页面,所以要加第三个参数,如下: $(document).pjax('.sidebar-menu a[target!=_blank]', '#pjax-content', { fragment: '#pjax-content' }); 意思就是如果是从完整的页面中取出对应的局部块内容,一定要配置fragment参数为局部选择器; 注:不可以配置timeout参数,不然也会有问题,好多相关博客内容都是乱转载的。 第二

php整合pjax(pushstate+ajax)实现无刷新页面

非 Y 不嫁゛ 提交于 2019-12-26 11:54:56
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> PJAX效果 通过url可以跟踪ajax的动态加载内容。这种技术尤其在two step view布局的视图中有很大的好处。无刷新加载页面,意味着响应速度和用户体验得到了极大的提升,在静态脚本和通用模块比较多的情况下,最大程度上节省了重用部分的开销。应用例子可以参考现在的google+、facebook和新版微博,同样是基于html5的pushState实现。g plus的表现最为明显,点击导航栏地址,箭头随目标移动,同时加载的页面淡入,效果很炫。 Dirty url 和 Clean url 在pjax出现之前,要实现页面的无刷新加载并通过url可以追踪,需要浏览器支持window.location.hash属性。通过判断url#锚后记录的地址来决定需要加载的内容,具体的构建方法是写一个hashchange的监视函数,当触发到hash改变时便判断加载内容。它的不足在于,对于低版本的浏览器例如ie6不支持hash,需要另外构建一个iframe来记录历史url实现前进和后退。最大的问题,便是#后生成的内容不会被搜索引擎索引到,google之前提供了 解决方案 ,提倡使用#!把地址引导到一个?escape_fragment=url的请求地址中,我在twitter、facebook、人人