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 7971661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:41:16+00:00 2026-06-04T07:41:16+00:00

I have the following code for a jquery message box. If I click on

  • 0

I have the following code for a jquery message box. If I click on the following link a message box appears.

<p><a id="msgup" class="">Demo Top</a></p>
<script>
    $("#msgup").bar({
        color            : '#1E90FF',
        background_color : '#FFFFFF',
        removebutton     : false,
        message          : 'Your profile customization has been saved!',
        time             : 2000
    }); 
</script>

Now what I am trying to achieve is show the message box when I get “cold” as value in my ajax server response. To achieve this I have tried the following code. but its not working. May be because it is failing to call the jquery function. Could you please how to make it work?

$.ajax({  
    type: "POST",
    url: "<?php echo base_url(); ?>contents/hello",
    data: "id="+a_href,
    success: function(server_response) {
        if (server_response == 'cold') {

        //Beginning of the code for message box
        $("#msgup").bar({
            color            : '#1E90FF',
            background_color : '#FFFFFF',
            removebutton     : false,
            message          : 'Your profile customization has been saved!',
            time             : 2000
        });
        //End of the code for message box

        // Instead of the message box code I have tried 
        // alert('Message'); and it worked
        }                       
        else {
            $("#result").html(server_response);
        }               
    }                              
}); //$.ajax ends

Thanks in advance 🙂

  • 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-06-04T07:41:17+00:00Added an answer on June 4, 2026 at 7:41 am
    $("#msgup").bar(…)
    

    binds a click event to #msgup (just guessing), so callin’ it from within the ajax code won’t help. One possible way to achieve your goal would be initializing $.bar and triggering a click from the ajax code, maybe this way:

    <p><a id="msgup" class="">Demo Top</a></p>
    <script>
        $("#msgup").bar({
            color            : '#1E90FF',
            background_color : '#FFFFFF',
            removebutton     : false,
            message          : 'Your profile customization has been saved!',
            time             : 2000
        });
        $.ajax({
            type: "POST",
            url: "<?php echo base_url(); ?>contents/hello",
            data: "id="+a_href,
            success: function(server_response){
                if (server_response == 'cold'){
                    //Beginning of the code for message box
                    $("#msgup").click();
                    //End of the code for message box
               } else {
                  $("#result").html(server_response);}                   
               }
            }                             
        });   
    </script> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following JQuery code: <script type=text/javascript> $(document).ready(function () { var $containerHeight =
I have the following Javascript code (using jQuery): floatUpAndDown(); function floatUpAndDown() { $(#bird).animate({top: '+=30px'},
I have my front end script which has the following jQuery code: $.get(/backend/post.php, {
I have the following code: @section ftr_scripts { <script src=//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js type=text/javascript></script> } Under the
I have the following code to generate Jquery UI tabs: <div id=tabs-loading-message style=display:none>Loading, Please
I have the following jquery code in my view <script type=text/javascript> $(document).ready(function () {
I have the following jquery code: $(document).ready(function() { $('button').click(function() { $.getJSON('http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/server/status?output=json', function(json) { alert(Entered
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 the following code using jQuery Validate. $(#register).validate({ debug: true, errorClass:'error', validClass:'success', errorElement:'span',
I have the following jQuery code which runs when I'm clicking an option in

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.