Say I have an online form, and I want to figure out whether a user is entering an email that's already in use by the system. Can I tell the system to check the field against the database as soon as the user moves their cursor / selection away from the field? Could anyone point me in the right direction if this is actually possible?

假设我有一个在线表单,我想弄清楚用户是否正在输入已经被系统使用的电子邮件。一旦用户将光标/选择移离字段,我是否可以告诉系统检查数据库中的字段?如果真的有可能,有人能指出我正确的方向吗?

5 个解决方案

#1


3

For this You need to call ajax when user writing an email id means on blur event as below :

为此,当用户编写电子邮件ID意味着模糊事件时,您需要调用ajax,如下所示:

    $('#yourfieldID').blur(function() {
       var val = $(this).val();
       $.ajax({
                type: 'POST',
                url: 'your url',
                data: {email: val},
                success: function (data) {
                    // check for response
                    });
                }
            });
    });

Now In file which you called in ajax url, Your need to check data which is exist in database or not and according to that you need to send response and check it in sucess part of ajax call.

现在在你用ajax url调用的文件中,你需要检查数据库中是否存在的数据,并根据你需要发送响应并在ajax调用的成功部分中检查它。

I hope you will get it.

我希望你能得到它。

更多相关文章

  1. Ajax的实用技术——用户的注意力从页面的其他区域到转移选择的图
  2. HTML Select字段通过ajax调用Web服务
  3. 阻止用户在表单字段中输入
  4. CORS错误:请求标头字段预检响应中的Access-Control-Allow-Headers
  5. 如何在选择单选按钮时显示文本字段
  6. 将输入文本字段显示为纯文本
  7. 将(重度公式加载的)Excel电子表格转换为用户友好的网络计算器
  8. 用户打开一个DropDown关闭其他DropDowns
  9. 在用户将'n'粘贴复制到文本字段后,如何更新视图模型?

随机推荐

  1. Android 入门教程:Android Studio 介绍
  2. Android 常用布局说明
  3. Android Edittext 显示光标 获取焦点 监
  4. android xml控件属性
  5. JS判断客户端是否是iOS或者Android
  6. 3.Spinner
  7. Android RecyclerView 设置显示滚动条属
  8. Android 8.1 zygote创建新应用进程
  9. 关于android的广播机制里面的网络状态监
  10. Android Button字母自动全部大写的问题