如何在 ASP.NET Web 表单中实际使用 JQuery Validation 远程验证
我到处搜索,但似乎找不到可靠的例子。
有人这样做吗?任何人都可以提供通过 aspx 页面(Web 表单)中的 WebMethod 使用 JQuery 验证插件调用远程验证的示例吗?
I have searched everywhere, and I can't seem to find a solid example.
Is anyone doing this? Can anyone provide and example of calling a remote validation using the JQuery validation plugin through a WebMethod in an aspx page (Web Forms)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为代码给你带来不好的品味的原因是因为将 json 写成字符串非常难闻。一个小小的改进是创建一个真正的 JSON 对象,然后使用 JSON.stringify(...) 函数。
使用您的 json 对象创建一个变量,这可以让您在设计时和运行时进行语法检查,
然后您可以将该行替换
为
您需要包含 https://github.com/douglascrockford/JSON-js/blob/master/json2.js
更多信息:
http://www.json.org/js.html
http://msdn.microsoft.com/en-us/library/cc836459(VS.85).aspx - 这是在 Windows 脚本编写的上下文中,但给出了功能的良好描述
I think the reason that code gives you a bad taste is because writing json as strings is pretty smelly. One slight improvement would be to create a real JSON object and then use the JSON.stringify(...) function.
Create a variable with your json object, this gives you syntax checking at design time and run time
then you could replace the line
with
you would need to include https://github.com/douglascrockford/JSON-js/blob/master/json2.js
more info:
http://www.json.org/js.html
http://msdn.microsoft.com/en-us/library/cc836459(VS.85).aspx - this is in the context of windows scripting but gives a good description of the function
正如我发布此文章时,我发现了一种有效的方法,但我真的不喜欢它。
非常麻烦,需要自己构建Json,这似乎不是一个好的解决方案。
Just as I posted this I found a way that works, but I really don't like it.
It is very cumbersome and requires constructing your own Json, which doesn't seem like a good solution.