There are important user experience aspects to consider when submitting forms via Ajax. In this video, learn the technique for disabling the form submit button so that it cannot be activated more than once.
- [Instructor] In this movie we'll look at the third…user experience improvement that we should always consider…when submitting forms via Ajax.…That is, we will disable the form button…so that the form can't be submitted more than once.…The process for disabling the button,…and then re-enabling it later,…is going to be similar to what we had for showSpinner.…As soon as calculateMeasurements is called,…before the Ajax request is even sent,…we're going to make that button be disabled,…and then once we get down here and we have a success,…onreadystatechange equals to four,…then we want to re-enable it,…just like we are hiding the spinner again,…and that will allow the user to then submit the form again.…
So we're only disabling it for the length of time…it takes to get a request back.…So let's write our code right here to disable the button.…Now we've already found the button down here…at the bottom of our page, you'll remember…we added an EventListener for it down here.…So I'm going to copy that, bring that line up here,…
- What is Ajax?
- Creating Ajax requests and responses
- Monitoring Ajax request state and events
- Responding to Ajax requests with HTML and JSON
- Building Ajax buttons
- Submitting forms with Ajax
- Implementing infinite scrolling
- Adding autosuggestions to text fields
Skill Level Intermediate
1. Ajax Defined
What is Ajax?5m 34s
2. Ajax Client
3. PHP Server
4. Ajax Button
5. Ajax Form Submission
6. Infinite Scrolling
7. Search Autosuggest
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.