Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks for your reply, this is along the lines I was thinking but I was very unsure. –  Sarah24 Nov 6 '12 at 16:01
    
Glad I could help. If this answers your questions, could you please mark as accepted? –  Braces for Impact Nov 6 '12 at 16:39
add comment

I would look at the following terms in the following order:

  1. Web Page
  2. Http Request
  3. 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.

share|improve this answer
1  
Another useful term to google is "web page life cycle", but I couldn't find the simple explanation I would have liked to reference. –  Rafael Cichocki Nov 6 '12 at 15:05
    
Thanks for your reply, I will take your advice :) –  Sarah24 Nov 6 '12 at 16:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.