开发者

Submitting Ajax Form With SimpleModal (jQuery)

开发者 https://www.devze.com 2023-03-11 14:51 出处:网络
I have a form within a SimpleModal modal, but when I try to use serialize with jQuery, the form data is always blank.The form serialize works outside of the modal, so theres something preventing the s

I have a form within a SimpleModal modal, but when I try to use serialize with jQuery, the form data is always blank. The form serialize works outside of the modal, so theres something preventing the serialize from grabbing the form data. This is the code I am using:

<div id="address_form" style="display:none">
  <div id="contact-area">
    <form id="address_form" action="submit" method="POST"开发者_如何学Go>
      <label for="Street">Street:</label>
      <input type="text" name="Street" id="street" />
      <input type="submit" name="submit" class="submit-button" />
    </form>
  </div>
</div>

$("#address_form").submit(function(){
  var data = $(this).serialize();
  alert(data)
  return false;
});


You have two elements with the id of address_form. Change the id on the DIV with that id and it will work.

0

精彩评论

暂无评论...
验证码 换一张
取 消