When validating form field entries using AJAX as described in the article Realtime Form Validation Using AJAX there are additional issues that come to mind. These include: 
  • Do I have to validate a single form field? Not necessarily. The article was written to show the simplest use case. You could also do validation based on any combination of form data. You should not consider this solution limited to input text fields as well.
  • What JavaScript event do I use to validate on? A validation using AJAX interactions on each keystroke could spell trouble for your server as the number of users increase. Consider combining timer-based events along with keystrokes for those of us that type really fast.
  • Should I use a GET or a POST with my XmlHttpRequests? A validation request does not change state on the server so a GET is appropriate for most cases. That said, make sure that you call the built in JavaScript encodeURIComponent() on all the form parameters you are sending as it will format them in a HTTP friendly way and is internationalization friendly. Consider using the HTTP POST method in cases where you are validating large amounts of data as not all web browsers support URLs that exceed 2,083 characters.
  • Should I use XML or text for the responses? If you do keep in mind the server resources that will be used to parse and generate the XML. Simple validation could be done with a simple text string. If you want to provide more information consider using JSON.

What issues do you face using AJAX to validate form data?