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

  • SEARCH
  • Home
  • 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 8272781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:14:51+00:00 2026-06-08T07:14:51+00:00

i have a page where i’m using a with id=emailfrnd, from the following script

  • 0

i have a page where i’m using a with id=”emailfrnd”, from the following script i successfully implemented the colorbox:

<script type="text/javascript">
$(document).ready(function(){
$("#emailfrnd").colorbox({
        inline: true,
        href:"#ef",
        close:"",
    opacity:0.95,
        onClosed:function(){
            //window.parent.location.reload(true);
        }
         });
 });
</script>

now the new colorbox contains a form with a send button in it of id “emailfrnd_submit” now i had written some validations using the jquery & ajax and if there are no errorMessages i’ll get another colorbox and the code is as follows:

if (errorMessage == '') {
    $.ajax({
        type: 'POST',
        url: root_url + '/services/services.php?method=emailfrnd',
        data: "name=" + name + "&email=" + email + "&message=" + message,
        async: true,
        success: function (data) {
            if (data == 1) {
                $("#emailfrnd_submit").colorbox({
                    inline: false,
                    close: "",
                    html: "<div style='height:230px;width:400px;display:block;'><p style='color:black;font:16px verdana;'>Your email was successfully sent.</p><br/><p style='color:gray; font:16px verdana;'>Thank you for telling your friend</p><div id='emailfrnd_sub' style='width: 50px;margin-top:30px;float: right;'><input type='submit' value='OK' name='emailfrnd_submit' id='emailfrnd_sub' class='redbut' style='float:right;position:absolute;right: 198px;margin-top: 0px;color:white;'></div></div>",
                    opacity: 0.95,
                    onClosed: function () {
                        //window.parent.location.reload(true);
                    }
                });
                //window.location.assign("../index.php");
            } else {
                alert('mail not send');
            }
        }
    });
} else {
    alert(errorMessage);
}
});

upto now i succeed in getting the things as i want, here after doing the validations and onclick the send button according to this code a new colorbox with the html content as above is coming, here i have a Ok button here, i want to make that button as the closing button of this colorbox. how can i get that functionality for the ok button here??
anyone help is much appreciated….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-08T07:14:53+00:00Added an answer on June 8, 2026 at 7:14 am

    You don’t need 2 colorboxes to do it.
    Why don’t you simple create a div which class is message_content and you update it’s text according to the ajax status ?
    It’s much better.

    Example:

    html:

    <div id="colorbox_content"> //@todo: change to colorbox id
    
        <form id="your_form">   //@todo: change according to your form id
    
        </form>
    
        <div class="message_content">
    
            <p class="message"></p>
            <span class="close"><a href="javascript:void(0);">Close</a></span>
    
        </div>
    
    </div>
    

    js:

    /**
     * Close message
     */
    jQuery('#colorbox_content').on('click', '.close', function() {
        jQuery(this).closest('#message_content').slideUp();
    });
    
    /**
     * On form submit
     */
    if (errorMessage == '') {
        $.ajax({
            type: 'POST',
            url: root_url + '/services/services.php?method=emailfrnd',
            data: "name=" + name + "&email=" + email + "&message=" + message,
            async: true,
            success: function (data) {
                if (data == 1) {
                    var message = "Your email was successfully sent.";
                    //window.location.assign("../index.php");
                } else {
                    var message = "Your email was successfully sent.";
                }
                jQuery('#colorbox_content').slideDown().find('.message').text(message);
            }
        });
    } else {
        alert(errorMessage);
    }
    

    Update based on this comment:

    If you want the same funcionality for different buttons you have to use the same class for them.
    here’s what do you need.
    demo

    I changed some ids to classes so you don’t need 2 events with the same code.

    And here’s the las version.
    You can see that you can store your options for each kind of colorbox and then pass them thrue parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have page and it has, <meta http-equiv=Content-Type content=text/html; charset=windows-1254> when i try to
i have page and it has, <meta http-equiv=Content-Type content=text/html; charset=windows-1254> when i try to
I have page handler with 95% traffic, it fetches model from DB using its
I have page which encoding is declared with <meta http-equiv=Content-Type content=text/html; charset=UTF-8 /> But
I have page (Default1.aspx) in which I am redirecting to another page (Default2.aspx) using
I have page which is redirected from htaccess. now I can pass the German
What is the best method of doing the following: I have Page A with
I have Page A which calls Page B using AJAX. Page B will be
I have page gets given an ArrayList<Document> where each document has a property called
I have page X. in X, i put in the head tag, a script

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.