php ajax 的问题
我正在尝试实现这个shoutbox
http://shoutbox.insanityville.com/
但有一些问题,修改 我想提出
问题 - 当用户忘记填写字段时,会显示错误消息并清除所有字段。
如何修改它以仅在成功时清除字段?
修改
如何使新消息像本例中那样滑入?
http://www.9lessons.info/2009/11/insert-delete-with-jquery-and-ajax.html
修改
如何添加验证码?
I am trying to implement this shoutbox
http://shoutbox.insanityville.com/
but there are a few issues and modifications I would like to make
issue - when a user forgets to fill a field an error message is displayed and all fields are cleared.
how can I modify it to clear the fields only on success?
modification
how can I make the new messages slide in like in this example?
http://www.9lessons.info/2009/11/insert-delete-with-jquery-and-ajax.html
modification
How can I add a captcha?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
成功处理程序的第一部分是清空输入字段,因此需要将其移至确定响应中是否有错误的逻辑之后:
需要 go
要实现 SlideDown 效果,您应该检查 < a href="http://api.jquery.com/slideDown" rel="nofollow">slideDown() 文档
要实现验证码,我建议 安全图像。它实现起来很简单,只需要一点服务器端验证和前端的输入框。然后,您只需修改传递给 $.ajax() 的
data
对象以包含附加输入值,并确保更新服务器端验证以在验证失败时包含正确的错误响应。The first part of the success handler is emptying the input fields, so this would need to be moved to after the logic which determines whether there was an error in the response:
Needs to go
To implement the slideDown effect, you should check out the slideDown() docs
To implement the CAPTCHA, I would recommend securimage. It's simple to implement, just takes a little server side validation and an input box on the front-end. You then just need to modify the
data
object being passed to $.ajax() to include the additional input value and make sure the server-side validation is updated to include a proper error response when validation fails.