validate with ajax

How to validate form when I use ajax?
and how to display vlidation message when I use remote_form_for?

can someone help me?