Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6960129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:21:45+00:00 2026-05-27T15:21:45+00:00

I have the following JQuery code: jQuery(function($) { $j(.follow_btn) .click( function() { var element

  • 0

I have the following JQuery code:

jQuery(function($) {
    $j(".follow_btn")
         .click(
        function() {
                var element = $(this);
                var I = element.attr("id");
            var info = 'id=' + I;
            $.ajax({
                type : "POST",
                url : "action/follow.php?friend_id=<?php echo $row_inactive_user_settings['user_id']; ?>",
                data : info,
                success : function() {
                }
            });
            $("#sb_follow" + I).hide();
            $("#sb_unfollow" + I).show();
            return false;
        });
     });
jQuery(function($) {
    $j(".unfollow_btn").click(
        function() {
            var element = $(this);
            var I = element.attr("id");
            var info = 'id=' + I;
            $.ajax({
                type : "POST",
                url : "action/unfollow.php?friend_id=<?php echo $row_inactive_user_settings['user_id']; ?>",
                data : info,
                success : function() {
                    }
            });
            $("#sb_unfollow" + I).hide();
            $("#sb_follow" + I).show();
            return false;
        });
    });

and following HTML code which trigger above JQuery:

<div id="sb_follow1"
<?php if ($totalRows_sb_track > 0) { echo 'style="display:none"';}?>>
    <a href="#" class="follow_btn" id="1">Follow</a>
</div>
<div id="sb_unfollow1"
<?php if ($totalRows_sb_track == 0) { echo 'style="display:none"';}?>>
    <a href="#" class="unfollow_btn" id="1">unFollow</a>
</div>

now what I need is to after I click on “Follow” link from above HTML code to show below container:

<dl id="subscribe">
 <ul id="ulg">
    <li>List one</li>
    <li>List two</li>
    <li>List three</li>
 </ul>
</dl>

And when I click on “unFollow” to hide that container I want to keep above JQuery code but also add this additional function. If someone is able to do necessary changes in above JQuery code that would be lovely. I also want to note that I have attached Prototype.js file to my pages.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:21:46+00:00Added an answer on May 27, 2026 at 3:21 pm

    Your jQuery would look like this:

    jQuery(function($) {
        $j(".follow_btn")
                .click(
                        function() {
                            var element = $(this);
                            var I = element.attr("id");
                            var info = 'id=' + I;
                            $
                                    .ajax({
                                        type : "POST",
                                        url : "action/follow.php?friend_id=<?php echo $row_inactive_user_settings['user_id']; ?>",
                                        data : info,
                                        success : function() {
                                        }
                                    });
                            $("#sb_follow" + I).hide();
                            $("#sb_unfollow" + I).show();
                            $("#subscribe").show();
                            return false;
                        });
    });
    jQuery(function($) {
        $j(".unfollow_btn")
                .click(
                        function() {
                            var element = $(this);
                            var I = element.attr("id");
                            var info = 'id=' + I;
                            $
                                    .ajax({
                                        type : "POST",
                                        url : "action/unfollow.php?friend_id=<?php echo $row_inactive_user_settings['user_id']; ?>",
                                        data : info,
                                        success : function() {
                                        }
                                    });
                            $("#sb_unfollow" + I).hide();
                            $("#sb_follow" + I).show();
                            $("#subscribe").hide();
                            return false;
                        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue I have this jQuery code: $(document).ready(function(){ $(#follow).click(function(){ $.ajax({ type: 'POST',
I have the following jquery code: jQuery(function(){ jQuery(select#rooms).change(function(){ var options = ''; jQuery.getJSON(/admin/selection.php,{id: jQuery(this).val(),
I have problems with the following bit of javascript/jquery code: this.droppable = function(){ $('.imageWindow
Fellow JQuery hackers, hello :-) Suppose you have the following code: $('.links').click(function(){ //Do something
I have following jQuery/JS code <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js></script> <script> $.getJSON(http://example/topics, {}, function(data){ console.log( data
I have the following code: $(document).ready(function() { // Manage sidebar category display jQuery(#categories >
Ok. I have the following jQuery code jQuery(function(){ jQuery.get('/GalleryPage.aspx?gallery=1234', {}, function(data) { galleryXML =
i have the following jquery code. basically i will have several overlapped divs and
I have the following JQuery code that worked perfect in C#/Asp.net 2.0 to call
I have the following JQuery code which does similar functionality like Stackoverflow where the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.