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.
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.
2
I would look at the following terms in the following order:
- Web Page
- Http Request
- Ajax
Ajax is just a special case of a communicating Web Content. So once you feel you understand what a web page is, understand Http Request, and then go to Ajax. The Http Request part might be very technical, but it’ll help you understand what javascript does when it implements ajax functionality.
1