I am saying that is you really want to understand this, you have to think about it yourself. Read the code. Don't expet to understand it just from someone else explaining it.
Also, I expect your ultimate goal is not to "to get the response submited by student in javascript". I hope your ultimate goal has something to do with education.