回复内容:
太通俗太形象毫无意义,只会让不懂的人更不懂。直白地说,就是没用AJAX的网页,你点一个按钮就要刷新一下页面,尽管新页面上只有一行字和当前页面不一样,但你还是要无聊地等待页面刷新。
用了AJAX之后,你点击,然后页面上的一行字就变化了,页面本身不用刷。
AJAX只是一种技术,不是某种具体的东西。不同的浏览器有自己实现AJAX的组件。
=====================================
突然想让这个答案更加完美,所以补充一下下面的内容:
ajax的全称是AsynchronousJavascript+XML。
异步传输+js+xml。
所谓异步,在这里简单地解释就是:向服务器发送请求的时候,我们不必等待结果,而是可以同时做其他的事情,等到有了结果我们可以再来处理这个事。(当然,在其他语境下这个解释可能就不对了)
这个很重要,如果不是这样的话,我们点完按钮,页面就会死在那里,其他的数据请求不会往下走了。这样比等待刷新似乎更加讨厌。
(虽然提供异步通讯功能的组件默认情况下都是异步的,但它们也提供了同步选项,如果你好奇把那个选项改为false的话,你的页面就会死在那里)
xml只是一种数据格式,在这件事里并不重要,我们在更新一行字的时候理论上说不需要这个格式,但如果我们更新很多内容,那么格式化的数据可以使我们有条理地去实现更新。
现在大部分人其实是用JSON这种格式来代替XML的,因为前者更加简洁,据说目前的解析速度也更快。多快好省,能省则省啊。
总结:只要是JS调用异步通讯组件并使用格式化的数据来更新web页面上的内容或操作过程,那么我们用的方法就可算是AJAX。 局部刷新 可以理解就是,以前向服务器请求资源,必须对这个页面资源进行请求以获得这个信息资源(以这个页面资源为载体来携带信息资源),这必然会对页面进行刷新(因为是请求服务器后会同步返回一个页面进行刷新)。
现在页面可以通过浏览器脚本编程语言调用一个隐藏请求装置(也就是XMLHttpRequest),由这个请求向服务器请求资源,然后返回一个资源载体(可能是一个页面,也可能是一个xml或json文段),然后由编程语言去处理这个信息。与此同时,页面是不会发生刷新行为的(也就是没有向服务器请求这个页面资源)。这就是异步原理了。
“AJA”就是异步JavaScript的缩写,其基础就是浏览器脚本编程语言JavaScript和XMLHttpRequest对象,X就是作为信息载体的XML,不过现在多数用JSON代替(xml解释麻烦,json是JavaScript的子类,容易在JavaScript里处理)。 A=异步
J=JavaScript
A=and
X=XML
使用AJAX的网页,内容是异步加载的。
没有使用AJAX的网页,在网页完全打开的时候,加载就完成了。
除非刷新或重新载入这个网页,浏览器不会再向服务器发出请求,内容也不会再发生变化。
以查看某支股票的股价为例。
过去没有AJAX时,网页会10秒定时刷新。
使用AJAX,只需要改变很小一部分内容就好可以了(甚至只是几个数字)。
数据量明显减少,对降低服务器端负载、缩短用户端等待时间都有好处。
A:异步,已经解释过。
J:浏览器端编程语言中,JavaScript是绝对的主导地位。
A:并列关系。
X:在出现HTML5之前,当时很多网页以XHTML为标准。XHTML基于XML。通过Javascript控制网页内容,实际就是针对XML进行DOM操作。 Ajax的全称是Asynchronous JavaScript and XML 中文名称定义为异步的JavaScript和XML。
Ajax是Web2.0技术的核心
由多种技术集合而成,使用Ajax技术不必刷新整个页面,只需对页面的局部进行更新,可以节省网络带宽,提高页面的加载速度,从而缩短用户等待时间,改善用户体验
我们传统的web应用,当我们提交一个表单请求给服务器,服务器接收到请求之后,返回一个新的页面给浏览器,这种做法浪费了很多带宽,因为我们发送请求之前和获得的新页面两者中很多的html代码是相同的,由于每次用户的交互都需要向服务器发送请求,应用的访问时间取决于服务器的返回时间。而我们使用Ajax就不同了,Ajax只取回一些必须的数据,它使用SOAP、XML或者支持json 的Web Service接口,我们在客户端利用JavaScript处理来自服务器的响应,这样客户端和服务器之间的数据交互就减少了,然后用户请求就得到了加速。
Ajax是多种技术的组合,包括我们的JavaScript 异步数据获取技术,就是XMLHttpRequest
以及xml以及Dom还有表现技术XHTML 和CSS
Ajax的核心是XMLHttpRequest 是支持异步请求的技术,可以发送请求给服务器,并且不阻塞用户
在IE浏览器中首次引用,使我们的网络应用更加强大。
其实XMLHttpRequest是JavaScript的一种语法子集,是它的一套API,支持发送GET和POST请求。
该API是Ajax开发的核心,也是现在web技术的核心之一。
通过这些技术,我们无序重新加载网页就可以发送和取回数据,完成交互。 如你刚开始学习网页制做,一个页面一个页面的转跳,开新窗口,输入,关闭,原窗口要手动或自动的刷新。相比现在流行的网页很low是不是。
现在我写个回答,发布,页面不用完全刷新,直接加在页面下方,是不是感觉体验好了些?
ajax,异步javascript和xml,就是不关闭不转跳不刷新的情况下,在网页后台提交数据,部分更新页面内容,将网页的用户体验提升到接近原生程序的地步。高端复杂点的甚至实现了单页app的程度。第一次下载可能慢点,但以后操作只与服务器交换关键数据,减轻服务器负担同时也提高了客户端运行的流畅性。 大学毕业拍毕业照,全班30人,一共去了29人。可是拍完之后,没参与照相的同学也想出现在照片中,该怎么办呢?
传统方式:大家再召集一次,重新拍一张。
Ajax:把这名同学PS进去
这就是Ajax的特点:
可以在不重新召集所有同学拍照的情况下,对照片的部分进行更新。
可以在不重新加载整个网页的情况下,对网页的某部分进行更新。
(重新拍照理解为重新加载网页)
这能够帮助你理解Ajax的特点,涉及具体的技术内容还得系统学习。 不用AJAX:你要看到天空,得跑到房子外面去看
使用AJAX:打开窗户就能看到天空,不用跑到外面去 就是网页就像一栋楼,你觉得不满意,要开个窗户你需要的就是再造个窗户(请求新数据并加载出来)而不需要重新再盖一栋楼 是什么,可自行wiki。AJAX
1.没用ajax:浏览器访问服务器请求,用户看得到(页面刷新也就等同于重新发请求,刷新看得到,也就等同于请求看得到)。等请求完,页面刷新,新内容出现,用户看到新内容。
2.用ajax:浏览器访问服务器请求,用户看不到,是悄悄进行。等请求完,页面不刷新,新内容也会出现,用户看到新内容。
1和2区别:都是发请求给服务器,都会看到新内容,只是一个是悄悄发。
用ajax好处:为了防止刷新页面,因为刷新页面的时间一般都是需要巨长时间,而我们用户讨厌等待,如果哪天刷新页面的时间可以做到0.01秒,那也可以考虑不用ajax。

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

Key players in HTTP cache headers include Cache-Control, ETag, and Last-Modified. 1.Cache-Control is used to control caching policies. Example: Cache-Control:max-age=3600,public. 2. ETag verifies resource changes through unique identifiers, example: ETag: "686897696a7c876b7e". 3.Last-Modified indicates the resource's last modification time, example: Last-Modified:Wed,21Oct201507:28:00GMT.

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 English version
Recommended: Win version, supports code prompts!

Dreamweaver CS6
Visual web 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.

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