Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>You don't need 2 colorboxes to do it</strong>.<br> Why don't you simple create a <code>div</code> which class is <code>message_content</code> and you update it's text according to the ajax status ?<br> It's much better.</p> <p><strong>Example</strong>:<br></p> <p><strong>html</strong>:</p> <pre><code>&lt;div id="colorbox_content"&gt; //@todo: change to colorbox id &lt;form id="your_form"&gt; //@todo: change according to your form id &lt;/form&gt; &lt;div class="message_content"&gt; &lt;p class="message"&gt;&lt;/p&gt; &lt;span class="close"&gt;&lt;a href="javascript:void(0);"&gt;Close&lt;/a&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>js</strong>:<br></p> <pre><code>/** * 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 + "&amp;email=" + email + "&amp;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); } </code></pre> <p>Update based on <a href="https://stackoverflow.com/questions/11566580/using-colorbox-over-another-colorbox-using-jquery-ajax/11571246#comment15310468_11571246">this</a> comment:<br></p> <p>If you want the same funcionality for different buttons you have to use the same <code>class</code> for them. here's what do you need.<br> <a href="http://jsfiddle.net/4vuDC/187/" rel="nofollow noreferrer"><strong>demo</strong></a></p> <p>I changed some <code>ids</code> to <code>classes</code> so you don't need 2 events with the same code.</p> <p>And here's the <a href="http://jsfiddle.net/4vuDC/190/" rel="nofollow noreferrer"><strong>las version</strong></a>.<br> You can see that you can store your <code>options</code> for each kind of colorbox and then pass them thrue parameter.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload