trancenergyy
trancenergyy

Reputation: 15

Colorbox and php form

I have a simple form page and i want to when the form is submit show the response message which came from my process.php in to colorbox. Thanks for your helping.

Upvotes: 0

Views: 3576

Answers (1)

Joseadrian
Joseadrian

Reputation: 4374

You could try with this

$("#link").colorbox({ inline:true, href: "#msg"});

$('input[type="submit"]').click(function(){
   $.ajax({
      type: "POST",
      url: "process.php",
      data: $('intpu[type="text"]').serialize(),
      success: function(data){
          $("#msg").html(data);
          $("#link").click(); // My mistake $("#link").colorbox(); This doesn't work
          return false;
      }
   });
   return false;
});

Your html

<form name="exam" method="post">
          <input size="60" type="text" name="quote" />
          <input type="submit"> 
</form>
<a id="link" style="display:none"></a>
<div id="msg" style="display:none;"></div>

Upvotes: 2

Related Questions