请问贴

Jun 13, 2016 pm 01:21 PM
ajax form google

请教贴 :
用form表单直接提交数据和用JS异步提交有什么不同?

------解决方案--------------------
form表单直接提交数据和JS异步提交数据没关系呀,各自提交各自的~~
你是说同步和异步提交的区别吧,其实他们也就那样,只不过异步提交可以实现页面无刷新效果而已。。
不对之处,求高手指点~~
------解决方案--------------------
表单(form)提交与AJAX提交适用的场合

1、表单提交(form)

1)、比较适合提交用户输入信息量比较大的场合。

2)、表单提交的可靠性相对比较好一些。

 

2、AJAX提交(异步请求)

1)、表单驱动的交互

在传统的表单提交中,如果想验证一下用户所输入信息的正确性就需要提交表单进行后端程序的验证;而此时用户所面对的就是一个白屏,生硬无趣!通过AJAX可以很好的改变这用户体验。

2)、树结构的导航

在表单提交中,如果想要展开某个结点树下的内容就需要进行一次表单提交,但这样就又出现了第一种情况所出现的问题。如果用AJAX可以解决响应速度,不重载页面以及避免向服务器频繁发送请求的问题。

3)、对数据进行过滤和操纵相关数据的场景

如果用户向服务器端发送了一个请求,服务器端可以给我们返回一个以json或是XML格式的信息。我们可以通过对这些返回进行过滤,以找到我们所需要的信息数据。

4)、自动完成功能

如:google和百度首页的自动完成功能(Auto Complete)

5)、替换大量折文本

使用AJAX来替换局部信息是一件不错的办法而且效果也比较直观。但是如果要用其来替换页面中大量的信息,那还不如做一次重新请求来完成。
参考原文:http://www.cntxk.com/CataNews/35/info11448.html

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Google Pixel 9 and Pixel 9 Pro rumoured to gain Creative Assistant AI upon release Google Pixel 9 and Pixel 9 Pro rumoured to gain Creative Assistant AI upon release Jun 22, 2024 am 10:50 AM

Google Pixel 9 and Pixel 9 Pro rumoured to gain Creative Assistant AI upon release

Google Tensor G4 of Pixel 9 Pro XL lags behind Tensor G2 in Genshin Impact Google Tensor G4 of Pixel 9 Pro XL lags behind Tensor G2 in Genshin Impact Aug 24, 2024 am 06:43 AM

Google Tensor G4 of Pixel 9 Pro XL lags behind Tensor G2 in Genshin Impact

Google app beta APK teardown reveals new extensions coming to Gemini AI assistant Google app beta APK teardown reveals new extensions coming to Gemini AI assistant Jul 30, 2024 pm 01:06 PM

Google app beta APK teardown reveals new extensions coming to Gemini AI assistant

Google Pixel 9 smartphones will not launch with Android 15 despite seven-year update commitment Google Pixel 9 smartphones will not launch with Android 15 despite seven-year update commitment Aug 01, 2024 pm 02:56 PM

Google Pixel 9 smartphones will not launch with Android 15 despite seven-year update commitment

Google AI announces Gemini 1.5 Pro and Gemma 2 for developers Google AI announces Gemini 1.5 Pro and Gemma 2 for developers Jul 01, 2024 am 07:22 AM

Google AI announces Gemini 1.5 Pro and Gemma 2 for developers

New Google Pixel desktop mode showcased in fresh video as possible Motorola Ready For and Samsung DeX alternative New Google Pixel desktop mode showcased in fresh video as possible Motorola Ready For and Samsung DeX alternative Aug 08, 2024 pm 03:05 PM

New Google Pixel desktop mode showcased in fresh video as possible Motorola Ready For and Samsung DeX alternative

Google Pixel 9 Pro XL gets tested with desktop mode Google Pixel 9 Pro XL gets tested with desktop mode Aug 29, 2024 pm 01:09 PM

Google Pixel 9 Pro XL gets tested with desktop mode

Google opens AI Test Kitchen & Imagen 3 to most users Google opens AI Test Kitchen & Imagen 3 to most users Sep 12, 2024 pm 12:17 PM

Google opens AI Test Kitchen & Imagen 3 to most users

See all articles