Difference: 1. Ajax submission is performed asynchronously, the web page does not need to be refreshed, but from form submission needs to be refreshed; 2. Ajax must be implemented with js, but the Form form is not required; 3. Ajax requires the use of a program To perform data processing on it, Form form submission is automatically completed according to the form structure and does not require code intervention.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
The difference between form submission and ajax submission
1. Usage scenarios:
Safety The properties are the same, and they are all sent using the http protocol. Security is related to the business processing of submitted files (format detection, anti-injection) and has nothing to do with the submission method.
Generally, a form is used to submit a login. Clicking submit triggers a submit event, which generally causes the page to jump. The control of page jumps and other behaviors is often in the backend, and the backend controls the page jumps and data transfer. ; But sometimes you don’t want the page to jump, or you want to put control on the front end and use js to operate the page jump or data change. Generally, ajax is used for such asynchronous operations.
But Ajax will have a hidden problem, that is, the browser does not save passwords, which is not in line with user habits. The ideal way: create a hidden iframe, point the target of the form tag to the iframe, and then detect the status of the iframe.
2. Comparison:
(1) Ajax is performed asynchronously when submitting, requesting, and receiving. The web page does not need to be refreshed. Only the part of the page is refreshed. It does not affect the content of other parts of the page.
Form submission is to create a new page. Even if it is submitted to its own page, it needs to be refreshed. In order to maintain the status change of the form by the page user, more parameters must be passed between the controller and the template. Maintain page status.
(2) When ajax is submitted, a new request is created in the background.
Form abandons this page and then requests again.
(3) Ajax must be implemented with js, which causes debugging troubles and browser compatibility issues. Moreover, browsers that do not enable js cannot complete the operation.
The Form form comes with the browser. You can submit the form regardless of whether js is enabled or not.
(4) When ajax submits, requests, and receives, the entire process requires the use of programs to process data.
Form form submission is automatically completed according to the form structure and does not require code intervention. Submit with submit.
3. Other aspects:
Regarding the verification of input content, ajax can use the program to judge the element content after getting it; there is verification in the attributes of the form form Fields are encapsulated in easyui, jeecg, etc. Users only need to add regular expression verification rules.
[Related tutorial recommendations: AJAX video tutorial]
The above is the detailed content of What is the difference between form form and ajax submission?. For more information, please follow other related articles on the PHP Chinese website!

KeysinReactarecrucialforoptimizingperformancebyaidinginefficientlistupdates.1)Usekeystoidentifyandtracklistelements.2)Avoidusingarrayindicesaskeystopreventperformanceissues.3)Choosestableidentifierslikeitem.idtomaintaincomponentstateandimproveperform

Reactkeysareuniqueidentifiersusedwhenrenderingliststoimprovereconciliationefficiency.1)TheyhelpReacttrackchangesinlistitems,2)usingstableanduniqueidentifierslikeitemIDsisrecommended,3)avoidusingarrayindicesaskeystopreventissueswithreordering,and4)ens

UniquekeysarecrucialinReactforoptimizingrenderingandmaintainingcomponentstateintegrity.1)Useanaturaluniqueidentifierfromyourdataifavailable.2)Ifnonaturalidentifierexists,generateauniquekeyusingalibrarylikeuuid.3)Avoidusingarrayindicesaskeys,especiall

Using indexes as keys is acceptable in React, but only if the order of list items is unchanged and not dynamically added or deleted; otherwise, a stable and unique identifier should be used as the keys. 1) It is OK to use index as key in a static list (download menu option). 2) If list items can be reordered, added or deleted, using indexes will lead to state loss and unexpected behavior. 3) Always use the unique ID of the data or the generated identifier (such as UUID) as the key to ensure that React correctly updates the DOM and maintains component status.

JSXisspecialbecauseitblendsHTMLwithJavaScript,enablingcomponent-basedUIdesign.1)ItallowsembeddingJavaScriptinHTML-likesyntax,enhancingUIdesignandlogicintegration.2)JSXpromotesamodularapproachwithreusablecomponents,improvingcodemaintainabilityandflexi

The article discusses HTML5 audio formats and cross-browser compatibility. It covers MP3, WAV, OGG, AAC, and WebM, and suggests using multiple sources and fallbacks for broader accessibility.

SVG and Canvas are HTML5 elements for web graphics. SVG, being vector-based, excels in scalability and interactivity, while Canvas, pixel-based, is better for performance-intensive applications like games.

HTML5 enables drag and drop with specific events and attributes, allowing customization but facing browser compatibility issues on older versions and mobile devices.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

WebStorm Mac version
Useful JavaScript development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1
Powerful PHP integrated development environment
