2

我正在使用 jQuery 验证引擎来验证我的注册 asp.net 表单

如何使用 ajax 功能检查用户名?

插件中有一些代码

"ajaxUserCall": {
    "url": "ajaxValidateFieldUser",
    // you may want to pass extra data on the ajax call
    "extraData": "name=eric",
        "alertText": "* This user is already taken",
        "alertTextLoad": "* Validating, please wait"
},
    "ajaxUserCallPhp": {
    "url": "phpajax/ajaxValidateFieldUser.php",
    // you may want to pass extra data on the ajax call
    "extraData": "name=eric",
    // if you provide an "alertTextOk", it will show as a green prompt when the field validates
    "alertTextOk": "* This username is available",
        "alertText": "* This user is already taken",
        "alertTextLoad": "* Validating, please wait"
},
    "ajaxNameCall": {
    // remote json service location
    "url": "ajaxValidateFieldName",
    // error
    "alertText": "* This name is already taken",
    // if you provide an "alertTextOk", it will show as a green prompt when the field validates
    "alertTextOk": "* This name is available",
    // speaks by itself
    "alertTextLoad": "* Validating, please wait"
},
    "ajaxNameCallPhp": {
    // remote json service location
    "url": "phpajax/ajaxValidateFieldName.php",
    // error
    "alertText": "* This name is already taken",
    // speaks by itself
    "alertTextLoad": "* Validating, please wait"
},

假设

  <WebMethod()> _
Public Shared Function getAvailability(ByVal Username As String) As String

    If Username = "rrrrrr" Then
        Return 1
    Else
        Return 0

    End If

End Function

方法与注册表单 signup.aspx 和脚本位于 js 文件夹中的同一页面中,我应该如何更改脚本?

4

0 回答 0