2015-10-21 06:58
浏览 78


In my code i have a form

 <form id="form_enquiry" name="enquiry-form">
                <input name="name" type="text" id="name" class="required"/>
                <input name="email" type="text" id="email" class="required"/>
                <input name="telephone" type="text" id="telephone" class="required"/>
                <textarea rows="4" name="message" id="message" class="required"></textarea>
                <label>How did you hear about us?</label>
                <div class="select-arrow">
                <select name="select_option" id="select_option" class="required">
                    <option value="" selected="selected">— — —</option>
                    <option value="I am a repeat customer">I am a repeat customer</option>
                    <option value="You where recommended to me">You where recommended to me</option>
                    <option value="Google Search">Google Search</option>
                    <option value="Travelzoo">Travelzoo</option>
                    <option value="Newspaper article">Newspaper article</option>
                    <option value="Facebook">Facebook</option>
                <button type="submit" id="enquiry_submit">Send</button>

this form i am submitting using jquery code

$("#form_enquiry").submit(function (e) {
        e.preventDefault(); // this will prevent from submitting the form.
             submitHandler: function(form) {

                var name1 = $('#name').val();
                var email1 = $('#email').val();
                var telephone1 = $('#telephone').val();
                var message1 = $('#message').val();
                var select_option1 = $('#select_option').val();
                var site_url = <?= $_SERVER['REQUEST_URI'] ?>;
                    if(name1 && email1 && telephone1 && message1 && select_option1) 
                            type: 'post',
                            url: '<?= base_url()?>'+'frontend/form_enquiry',
                            data: 'name='+name1+'&email='+email1+'&telephone='+telephone1+'&message='+message1+'&select_option='+select_option1+'&site_url='+site_url
                            //success: function(data) { $('#login_err').html('Success ...'); }


its working fine but in need to click the send button twice.. i want submit the form with a single click whats wrong in code help me...

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题