jQuery验证“远程"方法响应等待消息 [英] JQuery validation "remote" method response waiting message

查看:103
本文介绍了jQuery验证“远程"方法响应等待消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JQuery验证插件远程"方法进行基于Ajax的验证.

I am using JQuery validation plugin "remote" method for Ajax based validation.

但是我必须打一些第三方电话来验证数据,这大约需要花费时间. 30秒.

But I have to make some third party calls to verify data and it takes approx. 30 seconds.

因此,在Ajax请求处理数据时,需要向最终用户显示一些消息.任何人都可以帮助实现这一目标吗?

So need to show some message to end user while data is getting processed by Ajax request. Can anyone help to achieve this?

推荐答案

您可以从下面看到我完成的示例:

You can see an example from below that i done:

jQuery验证(远程方法):

jQuery Validate (Remote Method):

$("#myform").validate({
    rules: {
        email: {
            required: true,
            email: true,
            remote: {
                url: 'your-url-or-path-here.php',
                cache: false,
                dataType: 'POST', // Post, Get, Json, etc
                data: {
                    field: $('.element').val()
                }
                beforeSend: function () {
                    $('.loading').css('display','none').show();
                },
                complete: function () {
                    $('.loading').hide();
                }
            }
        }
    }
});

这篇关于jQuery验证“远程"方法响应等待消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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