RickH
-
Posts
2 -
Joined
-
Last visited
Posts posted by RickH
-
-
I've been working through the book and really enjoying it.
I'm thrown by the Contact Form example in the Ajax chapter. What it seems to be doing seems stupid, so I'm wondering whether I'm misunderstanding.
The handleAjaxRequest function is defined on p. 458. It seems to specify that in case of an error, we submit the form again. The anonymous function that is called if the user clicks the submit button is defined on p. 459. It sends the Ajax request to the server.
So if something goes wrong, we just try again? I thought perhaps we would send the form in a non-Ajaxy way, or something?
Regards, Rick
Chapter 11 - Handling Of Error Is To Do It Again?
in Modern Javascript: Develop and Design
Posted
Okay, thanks Larry.
The same thing happens again on pp. 576-7. But this time you say explicitly: "The else clause applies if the status code was not good, in which case the form will actually be submitted as if the JavaScript wasn't there."
I have a theory that when one calls the submit() function on a form, the form is submitted, but the submit event is not emitted. But I don't know whether my theory is true. Maybe something else is going on.
Regards, Rick