-1

Yesterday I had interview.

Interviewer asking me Why using Ajax instead of Form submit?

What is the difference between Ajax and Form Submit?

When using Form submit ?

When using Ajax?

I searched internet I am get exact and understandble answers.

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
Parameswaran
  • 314
  • 3
  • 12

2 Answers2

0

AJAX

web applications can send and retrieve data from a server asynchronously without interfering with the display and behavior of the existing page.

Integraty_dev
  • 500
  • 3
  • 18
0

Using Ajax is more user friendly. When you send a form using “form submit”, users should wait until a whole html page reloads and if some error occurs in data that your user sends then your user should try again. And your whole html page loads again and again.

If you use Ajax a small data sends to your server in the background and if something wrong happens then you can show that to your user. Your application feels more interactivity.

if you use Ajax instead of “form submit” in some situation when your user put some invalid data that should checks in the server (e.g. email that already taken) then you can send ajax to your server and alert user about invalid data (e.g. for this example email already taken, please try again).

Farid Saravi
  • 173
  • 1
  • 4