post data from form that was hidden using jquery

I have a form that I had hidden using jquery which on click is displayed.I want to post data using php but on clicking submit nothing happens.see code

 <div class="col-12 col-sm-2 with-click-text">
<form name="contactform" method="post" action="">
<table class="click-text font-light "width="450px"  >
<tr>
<td>
  <label for="first_name">First Name *</label> 
 <input  type="text" name="first_name" maxlength="50" size="30">
 <label for="last_name">Last Name *</label> 
 <td valign="top">  <input  type="text" name="last_name" maxlength="50" size="30"> 
  <label for="email">Email Address *</label>
  <input  type="text" name="email" maxlength="80" size="30" required> 
  <label for="telephone">Telephone Number</label>
   <input  type="text" name="telephone" maxlength="30" size="30"> 
  <label for="comments">Comments *</label>
  <textarea  name="comments" maxlength="1000" cols="25" rows="6" required></textarea> 
   <input type="submit" name="mailit" id="submit" value="Submit"> 
  </form>
</td>
</tr>
</table>
</div>

if(isset($_POST['mailit'])) { echo"do something";}

  $('.with-click-text').click(
    function(e) {
$(this).css('overflow', 'visible');
            $(this).find('.click-text')
                .show()
                .css('opacity', 0)
                .delay(200)
                .animate(
                    {
                        paddingTop: '25px',
                        opacity: 1
                    },
                    'fast',
                    'linear'
                );

    $("#submit").on("click",function(e){
    $(this).submit();

            });
            });

You have no element with id submit . Update your function;

....
$("input[type='submit']").on("click",function(){
    event.preventDefault();
    $(this).submit();

});

You can see demo here: Demo

链接地址: http://www.djcxy.com/p/69840.html

上一篇: 我如何验证我的电子邮件是否已经存在?

下一篇: 从使用jquery隐藏的表单发布数据