ajax 和 jquery 有什么区别,哪个更好?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/931908/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 10:09:44  来源:igfitidea点击:

what is the difference between ajax and jquery and which one is better?

jqueryajax

提问by Sufian Alali

I am confused about using ajax or jquery so I want to know what the differences are and which one is better such as performance and complexity .

我对使用 ajax 或 jquery 感到困惑,所以我想知道有什么区别,哪一个更好,例如性能和复杂性。

回答by tvanfosson

AJAXis a technique to do an XMLHttpRequest(out of band Http request) from a web page to the server and send/retrieve data to be used on the web page. AJAX stands for Asynchronous Javascript And XML. It uses javascript to construct an XMLHttpRequest, typically using different techniques on various browsers.

AJAX是一种从网页到服务器执行XMLHttpRequest(带外 Http 请求)并发送/检索要在网页上使用的数据的技术。AJAX 代表异步 Javascript 和 XML。它使用 javascript 来构造 XMLHttpRequest,通常在各种浏览器上使用不同的技术。

jQuery(website) is a javascript framework that makes working with the DOM easier by building lots of high level functionality that can be used to search and interact with the DOM. Part of the functionality of jQuery implements a high-level interface to do AJAX requests. jQuery implements this interface abstractly, shielding the developer from the complexity of multi-browser support in making the request.

jQuery网站)是一个 javascript 框架,它通过构建许多可用于搜索 DOM 并与 DOM 交互的高级功能,使处理 DOM 变得更加容易。jQuery 的部分功能实现了一个高级接口来执行 AJAX 请求。jQuery 抽象地实现了这个接口,使开发人员在发出请求时免受多浏览器支持的复杂性。

回答by Luke

On StackOverflow, pressing the up-vote button is AJAX whereas typing in your question or answer and seeing it appear in the real-time preview window below it is JavaScript (JQuery).

在 StackOverflow 上,按下投票按钮是 AJAX,而输入您的问题或答案并在其下方的实时预览窗口中看到它是 JavaScript (JQuery)。

This means that the difference between AJAX and Javascript is that AJAX allows you to communicate with the server without doing a page refresh (i.e. going to a new page) whereas JavaScript (JQuery) allows you to embed logic and behaviour on your page. Of course, with this logic you create AJAX as well.

这意味着 AJAX 和 Javascript 之间的区别在于,AJAX 允许您在不刷新页面(即转到新页面)的情况下与服务器通信,而 JavaScript (JQuery) 允许您在页面上嵌入逻辑和行为。当然,通过这种逻辑,您也可以创建 AJAX。

回答by ceejayoz

A more simple English explanation: jQuery is something that makes AJAX and other JavaScript tasks much easier.

更简单的英文解释:jQuery 使 AJAX 和其他 JavaScript 任务变得更加容易。

回答by PhilS

Ajaxis a technology / paradigm, whereas jquery is a library (which provides - besides other nice functionality - a convenient wrapper around ajax) - thus you can't compare them.

Ajax是一种技术/范式,而 jquery 是一个库(它提供 - 除了其他不错的功能 - 一个方便的 ajax 包装器) - 因此你无法比较它们。

回答by George Stocker

It's really not an 'either/or' situation. AJAX stands for Asynchronous JavaScript and XML, and JQuery is a JavaScript library that takes the pain out of writing common JavaScript routines.

这真的不是一个“非此即彼”的情况。AJAX代表一个同步ĴavaScript一个XML和jQuery是一个JavaScript库,采取痛苦满分作文常见的JavaScript程序的。

It's the difference between a thing (jQuery) and a process (AJAX). To compare them would be to compare apples and oranges.

这是事物(jQuery)和进程(AJAX)之间的区别。比较它们就像比较苹果和橙子。

回答by Mahtar

AJAXis a way of sending information between browser and server without refreshing page. It can be done with or without library like jQuery.

AJAX是一种无需刷新页面即可在浏览器和服务器之间发送信息的方式。它可以使用或不使用像jQuery这样的库来完成。

It is easier with the library.

图书馆更容易。

Here is a list of JavaScript libraries/frameworks commonly used in AJAX development.

以下是 AJAX 开发中常用的 JavaScript 库/框架列表。

回答by Emily

They aren't comparable.

他们没有可比性。

Ajax (Asynchronous Javascript and XML) is a subset of javascript. Ajax is way for the client-side browser to communicate with the server (for example: retrieve data from a database) without having to perform a page refresh.

Ajax(异步 Javascript 和 XML)是 javascript 的一个子集。Ajax 是客户端浏览器与服务器通信的方式(例如:从数据库中检索数据)而无需执行页面刷新。

jQuery is a javascript library that standardizes the javascript differences cross-browser. jQuery includes some ajax functions.

jQuery 是一个 javascript 库,它标准化了跨浏览器的 javascript 差异。jQuery 包含一些 ajax 函数。

回答by Chris Dale

Ajax is a way of using Javascript for communicating with serverside without loading the page over again. jQuery uses ajax for many of its functions, but it nothing else than a library that provides easier functionality.

Ajax 是一种使用 Javascript 与服务器端通信而无需重新加载页面的方式。jQuery 的许多功能都使用 ajax,但它只不过是一个提供更简单功能的库。

With jQuery you dont have to think about creating xml objects ect ect, everything is done for you, but with straight up javascript ajax you need to program every single step of the ajax call.

使用 jQuery,您不必考虑创建 xml 对象等,一切都为您完成,但是使用 javascript ajax,您需要对 ajax 调用的每一步进行编程。