问题描述
我开发一个网页中,需要下列功能的PHP:1.当用户点击表示感谢,应以改变完成!。2.同时,我想打电话给在indexController的动作。3.在这个时候,我想显示加载......4.当前页面有大量的动态内容,也应该不会改变。
I am developing a web-page in PHP that needs following functionality:1. When User click on "Say Thanks" it should be changed with "Done!".2. At the same time I want to call an action in indexController.3. At this time I want to show "loading...."4. The current page has a lot of dynamic contents that should also not change.
请建议我应该怎么做才能完成上述任务......
Please suggest me what should I do to complete above tasks......
推荐答案
我想你需要一个AJAX调用。我通常做的装载意见和这样的,当你preSS更多。就我而言,有一个空的div和< A>在链接的评论视图(带有单独行动,OFC)
标记。然后我使用jQuery的AJAX魔法:
I figure you need an AJAX call. I usually do that for loading comments and such when you press "more". In my case, there's an empty div and an <a>
tag with the link to the comments view (with a separate action, ofc). Then I use jQuery for the AJAX magic:
$(function() {
$("a.CommentsListBtn").click(function() {
var tmpHref = $(this).attr("href");
var tmpLayer = $(this).parent().children("div.CommentsList");
tmpLayer.load(tmpHref, function() {
tmpLayer.stop().slideDown("medium");
});
return false;
});
});
我希望这有助于。
I hope this helps.
这篇关于要显示与QUOT;装载.....&QUOT;在PHP页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!