2

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......

Charles
  • 48,924
  • 13
  • 96
  • 136
Pushpendra
  • 4,254
  • 3
  • 33
  • 64

2 Answers2

3

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.

mingos
  • 21,858
  • 11
  • 68
  • 105
2

Learn to use JQuery, JQuery UI. It isn't that hard! What I think you need to learn is the following for your problem:

Alfred
  • 56,245
  • 27
  • 137
  • 181