difference between ajax and form submit

At the simplest, with ajax, you don't witness page refresh while submitting form data. And if you don't use it eg you use submit buttons, you witness page refresh. Both submit the data.


A standard form submit sends a new HTTP request (POST or GET) and loads the new page in the browser. In Ajax, the data is sent to the server (POST or GET) in the background, without affecting the page at all, and the response is then received by javascript in the background, again without affecting the page at all.

(The javascript can, of course, then use the data received from the server to update some of the page content.)

Ajax is generally useful where only a small section of the page content will change.

Tags:

Forms

Ajax