admin管理员组文章数量:1287511
In my website / there's a form with several fields. When the page loads it shows the pace animation (it does some ajax request when loading so that's ok) but when I submit the form (I do it via ajax too) the animation doesn't appear. I tested uploading an image (so it would take longer) and still no animation is shown. I also tried changing the "async" parameter to true or false in the akax request but still no good.
Here's the specific code for the ajax call which is not working:
$.post('Sample.php,$(this).serialize(),function(data){
$(target).html(data);
},'html');
In my website http://www.eventiame./publicar/ there's a form with several fields. When the page loads it shows the pace animation (it does some ajax request when loading so that's ok) but when I submit the form (I do it via ajax too) the animation doesn't appear. I tested uploading an image (so it would take longer) and still no animation is shown. I also tried changing the "async" parameter to true or false in the akax request but still no good.
Here's the specific code for the ajax call which is not working:
$.post('Sample.php,$(this).serialize(),function(data){
$(target).html(data);
},'html');
Share
Improve this question
edited Jan 9, 2015 at 0:31
JasonMArcher
15k22 gold badges59 silver badges53 bronze badges
asked Dec 21, 2014 at 15:07
AliNasiriAliNasiri
1371 gold badge3 silver badges12 bronze badges
3
-
2
Typo? Shouldn't it be
'sample.php'
? – Christian Gollhardt Commented Dec 21, 2014 at 15:17 - it is not work with $.post or $.ajax() – AliNasiri Commented Dec 21, 2014 at 15:19
- same here it does not accept post request but it accept get request :) – Kavin Commented Jan 19, 2015 at 12:03
3 Answers
Reset to default 6I hope my answer is not too late, but in case of those that might still need it, i had thesame issue also and i solved it.
By default, Pace will show any ajax requests which begin as a part of a normal or ajax-y page load, or which last longer than 500ms. your ajax request didnt trigger the pace because it's too soon.
1, Modify the Pace.js :
Find restartOnRequestAfter
under the defaultOptions
and change it to desire time (in milliseconds) value 5
ms.
restartOnRequestAfter: 5,
2, Tracking:
By default, Pace will only track GET
HTTP method, so add all other method you might need such as POST
request.
ajax: {
trackMethods: ['GET', 'POST', 'PUT', 'DELETE', 'REMOVE'],
...
}
SOURCE: http://github.hubspot./pace/
You may try this:
$(document).ajaxStart(function() {
Pace.restart();
});
I had this same problem and I found a solution in Pace issues section. Source
You have a missing closing single quote, should be:
$.post('Sample.php', $(this).serialize(), function(data){
$(target).html(data);
}, 'html');
本文标签: javascriptAnimation not showing when ajax request in pacejsStack Overflow
版权声明:本文标题:javascript - Animation not showing when ajax request in pace.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741220136a2360813.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论