weixin_33722405 2015-03-23 19:43 采纳率: 0%
浏览 10

Zurb基金会遵守问题

Cannot get my form to submit using the Foundation 5 Abide code. If it take out the validation the code/ajax form submits perfectly. See code below, I'm sure I'm missing something. The form is only checking for valid email addresses right now, though I will add in checking for the first name and last name fields later if I can get this one validation to work first.

Form:

<form method="post" name="adduser" id="adduser" data-abide="ajax">
<fieldset>
<legend>Add New User</legend>    

<div class="small-2 columns">
<label class="inline">First Name
<input type="text" name="fname"/>
</label>
</div>

<div class="small-2 columns">
<label class="inline">Last Name
<input type="text" name="lname"/>
</label>
</div>

<div class="small-4 columns">
<label class="inline">Email
<input type="email" name="email"/>
</label>
</div>

<div class="small-2 columns">
<label class="inline">Access Type
<select  name="accesslvl">
<option value="1" selected>User</option>
<option value="2">Admin</option>
</select>
</label>
</div>

<div class="small-2 columns">
<input type="submit" class="button small adduserbtn" value="Add User" />
</div>
</fieldset>
</form>

Script:

$('#adduser').on('valid.fndtn.abide', function() {

     $.ajax({
          type: 'post',
          url: 'addnewuser.php',
          data: $('form').serialize(),
          success: function () {
               alert('User has been added successfully');
               window.location.reload(true);
          }
      });
});

Previous to adding the validation into the equation, I was submitting the form via this script, which was working fine and still does work when I remove the data-abide settings from the form.

 $('form').on('submit', function (a) {

      a.preventDefault();

      $.ajax({
        type: 'post',
        url: 'addnewuser.php',
        data: $('form').serialize(),
        success: function () {
          alert('User has been added successfully');
          window.location.reload(true);
        }
      });

    });

  });
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 家用射频美容仪技术规格
    • ¥25 matlab数值溢出该怎么解决?
    • ¥15 大家帮我看看为什么错了
    • ¥15 unity互动琴弦抖动效果
    • ¥15 做了个的二极管反向饱和电流测量电路,但是测试达不到效果
    • ¥15 nginx无证书访问https失败
    • ¥15 树莓派启动AP热点传入数据
    • ¥15 multisim中关于74ls192n和DSWPK开关的问题(相关搜索:计数器)
    • ¥15 在误装Windows server2019 后如何利用Windows.old恢复?
    • ¥20 代码实现状态连接包过滤防火墙的设计与实现