jQuery验证显示加载GIF,而远程请求 [英] jquery validation displaying loading GIF while remote requesting

查看:100
本文介绍了jQuery验证显示加载GIF,而远程请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我验证与jQuery验证插件的形式。我检查,如果给定的用户名已在数据库与远程选项。一切工作像预期,但我想说明一个加载GIF,同时验证脚本请求的服务器。有没有一种简单的方法来做到这一点还是需要编辑插件的js文件?反正,这里是重presentative code ..

I'm validating a form with the jquery validation plugin. I'm checking if a given username is already in db with the remote option. everything works like expected but I want to show a loading gif while the validation script is requesting the server. Is there an easy way to accomplish this or do I need to edit the plugin js file? anyways, here is the representative code..

 rules: {
   user_name: {
       alfanum:true,//custom method to check if alphanumeric
       required: true,
       minlength: 5,
       remote: {url: "checkuser_custom.php",type:"GET",data:{cmd:"check"}}
   }}

所以基本上我想要的readyState 2时,显示一个ajax加载GIF

So basically I want to display an ajax loading gif during readystate 2

任何帮助AP preciated!

any help appreciated!

推荐答案

根据 HTTP: //docs.jquery.com/Plugins/Validation/Methods/remote 的远程参数是一个完整的jQuery.ajax设置对象。请参见 http://api.jquery.com/jQuery.ajax 的实施细则。

According to http://docs.jquery.com/Plugins/Validation/Methods/remote the remote param is a full jQuery.ajax settings object. See http://api.jquery.com/jQuery.ajax for implementation details.

这篇关于jQuery验证显示加载GIF,而远程请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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