$(form).ajaxSubmit不是一个函数 [英] $(form).ajaxSubmit is not a function

查看:577
本文介绍了$(form).ajaxSubmit不是一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jquery validate插件来验证表单并使用ajax请求提交内容.

I'm trying to use the jquery validate plugin to validate a form and submit the contents with an ajax request.

此代码位于我的文档的开头.

This code is in the head of my document.

 $(document).ready(function() {
    $('#contact-form').validate({submitHandler: function(form) {
         $(form).ajaxSubmit();   
         contactSuccess() ;
         }
    });
});

验证有效. 但是,提交通常是这样进行的:在提交时,页面会重新加载. 当然,对于未启用js的浏览器,我具有非js后备行为.但我想获得更流畅的用户体验.

The validation works. However, the submission is made normally: On submission, the page reloads. Of course, I've got a non-js fallback behaviour for browsers that don't have js enabled. But I'd like to get the smoother user experience working.

我在萤火虫中看到的错误是: $(form).ajaxSubmit不是函数

The error that I see in firebug is: $(form).ajaxSubmit is not a function

我在这里怎么可能做错了?

What could I be doing wrong here?

推荐答案

我猜测您没有包含jquery表单插件.我相信ajaxSubmit不是核心的jquery函数.

I'm guessing you don't have a jquery form plugin included. ajaxSubmit isn't a core jquery function, I believe.

类似这样的内容: http://jquery.malsup.com/form/

UPD

<script src="http://malsup.github.com/jquery.form.js"></script> 

这篇关于$(form).ajaxSubmit不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆