JavaScript – AJAX Requests and Client-Side JavaScript

ajaxclient-sidejavascript

I am new to AJAX and trying to understand a question I've been given:

A HTTP request is generated by a form which contains some drop-down list. When the form is submitted, a new web page is displayed with some relevant text information (which is dependent on the list item selected).
Now, the same parameters are sent to the server via an AJAX request, and the same text information is returned.

Q. What tasks would the client-side JavaScript have to do to ensure a valid request was constructed and sent?

Any useful links or quick explanations greatly appreciated.

Best Answer

It would be best to check that a valid drop-down value has been selected before sending an AJAX request to the server. For example, drop-downs containing an option such as "Select One" will need to be validated, and the user should be notified of an invalid selection before the ajax request occurs.