Where do answers on a form go after hitting send or submit?

So where do the answers to the form end up after they’ve been sent? How do I handle/send the response in a real world scenario?

1 Like

The <form> element opentag will have an action="" attribute with the URL of the request page on the server. That page will read the POST data, validate it and make it safe to insert in the database (encode it), then do so. That page will likely handoff a success response, or a failure response, as applies. That page (or AJAX response) will be composed and sent back to the client.

Given only those two pieces of information, name and email, it’s likely this would be a signup for a subscription. When the row is created in the database, it may also be added to the mailing list of the periodical.

21 Likes

I had a similar question to @techbecca

I asked my questions here and got a couple of very helpful replies from @stetim94, which I think complement your post nicely :smiley:

2 Likes

Hi, @mtf.

I’ve tried to understand it fully thru this post that I’ve sent to @stetim94 in a thread started by @jon_morris.

I think I haven’t been quite mistaken in the development of my post, but now I’ve gotten a bit confused about what an AJAX response is.

I guess that, as @stetim94 would say, “make sure that if you jump in the deep end, that you don’t drown”… and that might be what I am doing just now: drowning in the deep end when I am just starting to tip my toes :sweat_smile:

Anyways, once again, thanks so much in advance.

Cheers.

1 Like

AJAX is short for, Asynchronous JavaScript And XML It is built on the XMLHttpRequest (XHR) object, and quickly gave rise to the JSON object. The methodology is all about talking with the server without disrupting the present is loaded state of the page. The local JS handles packaging, and the server side handler looks after the request/response. JS again unpacks the response and delivers it to the DOM. Done like dinner, and something worth devoting a few hours of reading toward. Today we also have FETCH, which should come up in your reading.


The web page in my profile is an old school example of AJAX using jQuery. In the source is the URL of the even older school vanilla XHR. Bear in mind it was written by a learner, not a schooled programmer.

6 Likes

Wow :eyes:

Definitively, something I hope to learn about as I keep going thru every lesson, kinda of incomprehensible for me at the moment. Doubtlessly, I drowned this time :sweat_smile:

Thanks a lot, though, once again.

Cheers.

3 Likes

Hey @ibaifernandez,

Don’t worry, I understand how you feel about things seeming incomprehensible at first. I’m now over a year on in my coding journey, since I originally asked these similar questions to you, and after learning how to make AJAX requests and use fetch with JavaScript, things make sense to me now. Things do gradually become clearer as you learn and experiment more and build upon initial foundations. But it is a gradual process. You are asking all of the right questions, and you’ll pick it up so much quicker by wanting to go deeper, but I’ve learnt that it’s also imporatnt to just accept some things as given, otherwise you will blow a fuse :exploding_head: :wink: So much of programming is interconnected, and so if you are learning productively you will naturally always be left with unresolved questions. Rest assured, though, if you are patient, and keep asking questions, things will eventually click into place. It’s a great feeling when a few months (or even a year) down the line you suddenly find unresolved questions, that you had to put on the back burner, getting answered in “Ah-ha!” moments, when studying other things :slight_smile:

7 Likes

Thank you, @jon_morris.

Wise words indeed. I see myself reflected upon them. Thank you for your comment: it definitively encourages me to keep going now that I’d had to leave all of my learning aside due to professional reasons. I’m actually not good at all at coding yet, but I am kinda good at coordinating projects which are code-based. I just act as the marketing liaison among my agency’s clients and the programmers who I work with to develop and market solutions to small- and medium-sized businesses. And, may I say quite proudly, I’ve met a fair deal of success in the last few weeks. Regrettably, I’ve been devoting pretty much all of my awake hours to those projects, so much so that when I got back to my JavaScript lessons a couple weeks ago, I’d forgotten most of it and had to review it all from the very beginning :sweat: Anyways, once again, such a pleasure to read your words.

Cheers!

1 Like

I know this may have been answered, but I wanted to explain a bit in a beginners term.
You may find this helpful if submission.html value of the action attribute confuses you, because after submission, we are referred to the submission page…

Here is the deal, and i stand to be corrected. The value of the action attribute signifies where the data of the form entry goes - in this case, submission.html. See the submission page as a normal html page that with possible CSS styling with a message

Thank You For Submitting"

The actual data collected from the page is not visible because of the method attribute value POST. If we were to change the method value to GET, and observe the link, we will notice our form data is visible just after the ? in the link. That is how this form data is being sent in this case.

I hope this helps.

3 Likes

Thanks for the Helpful info :smiley:

1 Like

I just personally blew a fuse over not being able to log in. I would type a letter and then my cursor would pop to the search bar. Which is why I am back tracking to see if I may have missed something. I thought well maybe I need to learn where the submitted info is going but, I think I may have just had my desktop page hacked because after deleting it I was able to get logged on. I am defiantly grateful not to have drowned in shallow water lol