JQuery的ValidationEngine,让AJAX调用vb.net Web服务 [英] JQuery ValidationEngine making AJAX calls to vb.net Web Service

查看:181
本文介绍了JQuery的ValidationEngine,让AJAX调用vb.net Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看着在插件的主页上给出的文档实例和AJAX的例子似乎并不奏效。

I've looked into the documentation examples given at the Plugin's home page and the AJAX examples don't seem to be working.

另外,我见过的所有例子已经为PHP / JAVA / ETC。

In addition, all the examples I've seen have been for PHP/JAVA/ETC.

我真正寻找的是使用Ajax类型的验证器检查对一个VB.NET Web服务使用jQuery插件ValdiationEngine一个简单的例子。哪些文件需要修改?或者,可以将它全部来自与它的验证页面内完成。是否有web服务需要返回,任何特定的格式等。

What I'm really looking for is a simple example using the JQuery Plugin ValdiationEngine using an AJax type validator which checks against a VB.NET web Service. Which files need to be modified? Or can it all be done from within the page with the validator on it. Is there any specific format that the webservice needs to return, etc.

下面是有问题的插件: http://posabsolute.github.com/jQuery-验证发动机/

Here is the plugin in question: http://posabsolute.github.com/jQuery-Validation-Engine/

推荐答案

我们使用这个为调用一个ASP.Net网页setvice ajax的验证规则。所有您需要做的是写在你的语言文件中的规则。

We use this for an ajax validation rule that calls an ASP.Net web setvice. All you have to do is write the rule in your language file.

下面是我们的:

"ajaxEmailCheck": {
    "url": "/json_api/AjaxEmailCheck/",
    "extraDataDynamic": ['#EmailAddress'],
    "alertText": "* An Account with this email has already been created.",
    "alertTextLoad": "* Validating, please wait..."
},

这一个叫网址/ json_api / AjaxEmailCheck并传递电子邮件地址。那么,我们的现场是这样定义的:

This one calls the url /json_api/AjaxEmailCheck and passes the Email address. Then our field is defined like this:

<input type="email" 
       name="email_address" 
       title="Email Address" 
       id="email_address" 
       class="validate[required,custom[onlyLetNumSpec],ajax[ajaxEmailCheck]] 
/>

此外,这里的上面使用的onlyLetNumSpc规则:

Also, here's the onlyLetNumSpc rule used above:

"onlyLetNumSpec": {
    // Good for database fields
    "regex": /^[^\\]+$/,
    "alertText": "* Any Character is allowed with the exception of backslash(\)."
}

从Web服务返回的数据是这样的:

The data returned from the web service looks like this:

"{"EmailAddress":true}"

如果已经通过电子邮件的存在:

And if the email passed already exists:

"{"EmailAddress":false,"Error":"* An Account with this email has already been created."}"

这篇关于JQuery的ValidationEngine,让AJAX调用vb.net Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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