What is the difference between AJAX with jQuery and AJAX with JavaScript?
AJAX与jQuery和AJAX与JavaScript的区别是什么?
8 个解决方案
#1
38
Javascript, for the purposes of this question, is a client-side (in the browser) scripting language.
出于这个问题的目的,Javascript是一个客户端(在浏览器中)脚本语言。
jQuery is a library/framework built with Javascript. It is very popular because it (nearly universally) abstracts away cross-browser compatibility issues and it emphasises unobtrusive and callback-driven Javascript programming.
jQuery是一个用Javascript构建的库/框架。它非常流行,因为它(几乎是普遍的)抽象出了跨浏览器兼容性问题,并强调了不引人注目和回调驱动的Javascript编程。
AJAX (Asynchronous Javascript XML) is a method to dynamically update parts of the UI without having to reload the page - to make the experience more similar to a desktop application.
AJAX(异步Javascript XML)是一种不需要重新加载页面就能动态更新UI部分的方法,以使体验更类似于桌面应用程序。
EDIT:
编辑:
It sounds like you're new to this. I would seriously recommend you check out http://www.w3schools.com/js/default.asp to get started. It's what I used to learn javascript and it's done incredibly well.
听起来你是新手。我将郑重地推荐您登录http://www.w3schools.com/js/default.asp开始。这就是我过去学习javascript的方法,而且做得非常好。
#2
52
Actually only one of them is a programming language.
实际上只有一种是编程语言。
-
Javascript is a programming language which is used mainly in webpages for making websites interactive. In this context, when a webpage is parsed by the browser, it creates an in-memory representation of the page. It is a tree structure, which contains all elements on the page. So there is a root element, which contains the head and the body elements, which contain other elements, which contain other elements. So it looks like a tree basically. Now with javascript you can manipulate elements in the page using this tree. You can pick elements by their id (getElementsById), or their tag name (getElementsByTagName), or by simply going through the tree (parentNode, firstChild, lastChild, nextSibling, previousSibling, etc.). Once you have element(s) to work with you can modify them by changing their look, content or position on the page. This interface is also known as the DOM (Document Object Model). So you can do everything with Javascript that another programming language can do, and by using it embedded into wepages you also get an in-memory Object of the current webpage by which you can make changes to the page interactively.
Javascript是一种编程语言,主要用于网页的交互。在这种情况下,当浏览器解析网页时,它会创建页面的内存中表示。它是一个树结构,包含页面上的所有元素。所以有一个根元素,它包含头部和身体元素,其中包含其他元素,其中包含其他元素。看起来就像一棵树。现在,使用javascript,您可以使用这个树来操作页面中的元素。您可以通过它们的id (getElementsById),或者它们的标记名称(getElementsByTagName),或者通过简单的通过树(parentNode, firstChild, lastChild, nextSibling, previousSibling,等等)来选择元素。一旦有了要处理的元素,就可以通过更改它们在页面上的外观、内容或位置来修改它们。这个接口也称为DOM(文档对象模型)。你可以用Javascript做其他编程语言可以做的任何事情,通过使用嵌入到wepages中的Javascript,你也可以得到当前网页的内存对象,通过这个对象,你可以交互地对页面进行修改。
In recent years JavaScript has also become a popular server-side language running in an environment called Node.js. This opened up a way for you to share common parts of your code between the browser and the server.
近年来,JavaScript也成为在Node.js环境中运行的一种流行的服务器端语言。这为您在浏览器和服务器之间共享代码的公共部分提供了一种途径。
-
AJAX is a technique of communication between the browser and the server within a page. Chat is a good example. You can write a message, send a message and recive other messages without leaving the page. You can manage this network interaction with Javascript on the client side, using an XMLHTTP Object provided by the browser.
AJAX是浏览器与页面内服务器之间的通信技术。聊天就是一个很好的例子。您可以编写消息、发送消息和接收其他消息而无需离开页面。您可以使用浏览器提供的XMLHTTP对象,在客户端管理与Javascript的网络交互。
-
jQuery is a library which aims to simplify client side web development in general (the other two above). It creates a layer of abstracion so you can reuse common languages like CSS and HTML in Javascript. It also includes functions which can be used to communicate with servers very easily (AJAX). It is written in Javascript, and will not do everything for you, only makes common tasks easier. It also hides some of the misconceptions and bugs of browsers.
jQuery是一个旨在简化客户端web开发的库(上面的另外两个)。它创建了一个抽象层,以便在Javascript中重用CSS和HTML等通用语言。它还包含一些函数,这些函数可以很容易地与服务器通信(AJAX)。它是用Javascript编写的,不会为您做任何事情,只会使常见任务更容易。它还隐藏了一些浏览器的误解和bug。
To sum up:
总结:
- Javascript is a programming language (objects, array, numbers, strings, calculations)
- Javascript是一种编程语言(对象、数组、数字、字符串、计算)
- AJAX and jQuery uses Javascript
- AJAX和jQuery使用Javascript
- jQuery is for simplifing common tasks with AJAX and page manipulation (style, animation, etc.)
- jQuery用于使用AJAX和页面操作简化常见任务(样式、动画等)。
Finally, an example just to see some syntax:
最后,举个例子看看语法:
// page manipulation in javascript
var el = document.getElementById("box");
el.style.backgroundColor = "#000";
var new_el = document.createElement("div");
el.innerHTML = "<p>some content</p>";
el.appendChild(new_el);
// and how you would do it in jQuery
$("#box")
.css({ "background-color": "#000" })
.append("<div><p>some content</p></div>");
#3
31
Of the three only javascript is a programming language. jQuery is a framework that is based on javascript and that simplifies some tedious tasks like manipulating the DOM, adding some effects and animations and most importantly doing it in a cross browser fashion. One of the tasks that is simplified by jQuery is AJAX which is a concept allowing a browser to send an asynchronous request to a web server allowing for richer web applications.
在这三种语言中,只有javascript是一种编程语言。jQuery是一个基于javascript的框架,它简化了一些繁琐的任务,比如操作DOM,添加一些效果和动画,最重要的是,用跨浏览器的方式进行操作。jQuery简化的任务之一是AJAX,这一概念允许浏览器向web服务器发送异步请求,从而实现更丰富的web应用程序。
#4
11
AJAX is technology. Jquery is library. Javascript is language.
AJAX技术。Jquery是图书馆。Javascript是语言。
#5
3
AJAX is a method to do an XMLHttpRequest from a web page to the server and send/retrieve data to be used on the web page. It stands for Asynchronous Javascript And XML. It uses javascript to construct an XMLHttpRequest(varies between browsers).
AJAX是将XMLHttpRequest从web页面发送到服务器,并将数据发送/检索到web页面上。它代表异步Javascript和XML。它使用javascript构造XMLHttpRequest(不同浏览器之间有所不同)。
jQuery is a javascript framework that can be used to manipulate the DOM (search and interact with the DOM). jQuery implements a high-level interface to do AJAX requests abstractly thereby giving multi-browser support in making the request.
jQuery是一个javascript框架,可用于操作DOM(搜索和与DOM交互)。jQuery实现了一个高级接口来抽象地处理AJAX请求,从而在发出请求时提供了多浏览器支持。
So, Ajax is a technology paradigm, whereas jquery is a library so can't compare them.
因此,Ajax是一种技术范式,而jquery是一种库,因此无法对它们进行比较。
#6
1
AJAX is a way to talk to the server in the background. JavaScript is a language that the browser understands. jQuery is a JavaScript framework that makes life easier for people who want to program for the browser.
AJAX是在后台与服务器对话的一种方式。JavaScript是浏览器理解的语言。jQuery是一个JavaScript框架,对于那些想要为浏览器编程的人来说,它让事情变得更简单。
#7
0
-
JS is a client-side programming language.
JS是一种客户端编程语言。
-
jQuery is a framework, but isn't the only one. Another JS frameworks are AngularJS, Mootools, NodeJS, BackboneJS, etcetera. With anyone of this frameworks you will do any action that pure JS can't do, or any "complex" (I don't find the correct word) action. As Void said, adapting his answer to my answer about frameworks: "makes life easier for people who want to program for the browser."
jQuery是一个框架,但不是唯一的框架。另一个JS框架是AngularJS、Mootools、NodeJS、BackboneJS等。对于这些框架中的任何人,您都将执行纯JS无法执行的任何操作,或者任何“复杂”(我找不到正确的词)操作。正如Void所说,他将他的回答与我关于框架的回答相一致:“对于那些想为浏览器编程的人来说,这让事情变得更容易。”
-
With AJAX you can communicate your Web page to the server. AJAX depends on JS to work.
使用AJAX,您可以将Web页面与服务器通信。AJAX依赖于JS来工作。
#8
-7
Javascript is a scripting language, Not a programing language. Jquery and ajax are simplified version of javascript which helps manupulate queries of certain part of website without having to change the entire user interface of the website.
Javascript是一种脚本语言,不是编程语言。Jquery和ajax是javascript的简化版本,它帮助管理网站某些部分的查询,而无需更改网站的整个用户界面。
#1
38
Javascript, for the purposes of this question, is a client-side (in the browser) scripting language.
出于这个问题的目的,Javascript是一个客户端(在浏览器中)脚本语言。
jQuery is a library/framework built with Javascript. It is very popular because it (nearly universally) abstracts away cross-browser compatibility issues and it emphasises unobtrusive and callback-driven Javascript programming.
jQuery是一个用Javascript构建的库/框架。它非常流行,因为它(几乎是普遍的)抽象出了跨浏览器兼容性问题,并强调了不引人注目和回调驱动的Javascript编程。
AJAX (Asynchronous Javascript XML) is a method to dynamically update parts of the UI without having to reload the page - to make the experience more similar to a desktop application.
AJAX(异步Javascript XML)是一种不需要重新加载页面就能动态更新UI部分的方法,以使体验更类似于桌面应用程序。
EDIT:
编辑:
It sounds like you're new to this. I would seriously recommend you check out http://www.w3schools.com/js/default.asp to get started. It's what I used to learn javascript and it's done incredibly well.
听起来你是新手。我将郑重地推荐您登录http://www.w3schools.com/js/default.asp开始。这就是我过去学习javascript的方法,而且做得非常好。
#2
52
Actually only one of them is a programming language.
实际上只有一种是编程语言。
-
Javascript is a programming language which is used mainly in webpages for making websites interactive. In this context, when a webpage is parsed by the browser, it creates an in-memory representation of the page. It is a tree structure, which contains all elements on the page. So there is a root element, which contains the head and the body elements, which contain other elements, which contain other elements. So it looks like a tree basically. Now with javascript you can manipulate elements in the page using this tree. You can pick elements by their id (getElementsById), or their tag name (getElementsByTagName), or by simply going through the tree (parentNode, firstChild, lastChild, nextSibling, previousSibling, etc.). Once you have element(s) to work with you can modify them by changing their look, content or position on the page. This interface is also known as the DOM (Document Object Model). So you can do everything with Javascript that another programming language can do, and by using it embedded into wepages you also get an in-memory Object of the current webpage by which you can make changes to the page interactively.
Javascript是一种编程语言,主要用于网页的交互。在这种情况下,当浏览器解析网页时,它会创建页面的内存中表示。它是一个树结构,包含页面上的所有元素。所以有一个根元素,它包含头部和身体元素,其中包含其他元素,其中包含其他元素。看起来就像一棵树。现在,使用javascript,您可以使用这个树来操作页面中的元素。您可以通过它们的id (getElementsById),或者它们的标记名称(getElementsByTagName),或者通过简单的通过树(parentNode, firstChild, lastChild, nextSibling, previousSibling,等等)来选择元素。一旦有了要处理的元素,就可以通过更改它们在页面上的外观、内容或位置来修改它们。这个接口也称为DOM(文档对象模型)。你可以用Javascript做其他编程语言可以做的任何事情,通过使用嵌入到wepages中的Javascript,你也可以得到当前网页的内存对象,通过这个对象,你可以交互地对页面进行修改。
In recent years JavaScript has also become a popular server-side language running in an environment called Node.js. This opened up a way for you to share common parts of your code between the browser and the server.
近年来,JavaScript也成为在Node.js环境中运行的一种流行的服务器端语言。这为您在浏览器和服务器之间共享代码的公共部分提供了一种途径。
-
AJAX is a technique of communication between the browser and the server within a page. Chat is a good example. You can write a message, send a message and recive other messages without leaving the page. You can manage this network interaction with Javascript on the client side, using an XMLHTTP Object provided by the browser.
AJAX是浏览器与页面内服务器之间的通信技术。聊天就是一个很好的例子。您可以编写消息、发送消息和接收其他消息而无需离开页面。您可以使用浏览器提供的XMLHTTP对象,在客户端管理与Javascript的网络交互。
-
jQuery is a library which aims to simplify client side web development in general (the other two above). It creates a layer of abstracion so you can reuse common languages like CSS and HTML in Javascript. It also includes functions which can be used to communicate with servers very easily (AJAX). It is written in Javascript, and will not do everything for you, only makes common tasks easier. It also hides some of the misconceptions and bugs of browsers.
jQuery是一个旨在简化客户端web开发的库(上面的另外两个)。它创建了一个抽象层,以便在Javascript中重用CSS和HTML等通用语言。它还包含一些函数,这些函数可以很容易地与服务器通信(AJAX)。它是用Javascript编写的,不会为您做任何事情,只会使常见任务更容易。它还隐藏了一些浏览器的误解和bug。
To sum up:
总结:
- Javascript is a programming language (objects, array, numbers, strings, calculations)
- Javascript是一种编程语言(对象、数组、数字、字符串、计算)
- AJAX and jQuery uses Javascript
- AJAX和jQuery使用Javascript
- jQuery is for simplifing common tasks with AJAX and page manipulation (style, animation, etc.)
- jQuery用于使用AJAX和页面操作简化常见任务(样式、动画等)。
Finally, an example just to see some syntax:
最后,举个例子看看语法:
// page manipulation in javascript
var el = document.getElementById("box");
el.style.backgroundColor = "#000";
var new_el = document.createElement("div");
el.innerHTML = "<p>some content</p>";
el.appendChild(new_el);
// and how you would do it in jQuery
$("#box")
.css({ "background-color": "#000" })
.append("<div><p>some content</p></div>");
#3
31
Of the three only javascript is a programming language. jQuery is a framework that is based on javascript and that simplifies some tedious tasks like manipulating the DOM, adding some effects and animations and most importantly doing it in a cross browser fashion. One of the tasks that is simplified by jQuery is AJAX which is a concept allowing a browser to send an asynchronous request to a web server allowing for richer web applications.
在这三种语言中,只有javascript是一种编程语言。jQuery是一个基于javascript的框架,它简化了一些繁琐的任务,比如操作DOM,添加一些效果和动画,最重要的是,用跨浏览器的方式进行操作。jQuery简化的任务之一是AJAX,这一概念允许浏览器向web服务器发送异步请求,从而实现更丰富的web应用程序。
#4
11
AJAX is technology. Jquery is library. Javascript is language.
AJAX技术。Jquery是图书馆。Javascript是语言。
#5
3
AJAX is a method to do an XMLHttpRequest from a web page to the server and send/retrieve data to be used on the web page. It stands for Asynchronous Javascript And XML. It uses javascript to construct an XMLHttpRequest(varies between browsers).
AJAX是将XMLHttpRequest从web页面发送到服务器,并将数据发送/检索到web页面上。它代表异步Javascript和XML。它使用javascript构造XMLHttpRequest(不同浏览器之间有所不同)。
jQuery is a javascript framework that can be used to manipulate the DOM (search and interact with the DOM). jQuery implements a high-level interface to do AJAX requests abstractly thereby giving multi-browser support in making the request.
jQuery是一个javascript框架,可用于操作DOM(搜索和与DOM交互)。jQuery实现了一个高级接口来抽象地处理AJAX请求,从而在发出请求时提供了多浏览器支持。
So, Ajax is a technology paradigm, whereas jquery is a library so can't compare them.
因此,Ajax是一种技术范式,而jquery是一种库,因此无法对它们进行比较。
#6
1
AJAX is a way to talk to the server in the background. JavaScript is a language that the browser understands. jQuery is a JavaScript framework that makes life easier for people who want to program for the browser.
AJAX是在后台与服务器对话的一种方式。JavaScript是浏览器理解的语言。jQuery是一个JavaScript框架,对于那些想要为浏览器编程的人来说,它让事情变得更简单。
#7
0
-
JS is a client-side programming language.
JS是一种客户端编程语言。
-
jQuery is a framework, but isn't the only one. Another JS frameworks are AngularJS, Mootools, NodeJS, BackboneJS, etcetera. With anyone of this frameworks you will do any action that pure JS can't do, or any "complex" (I don't find the correct word) action. As Void said, adapting his answer to my answer about frameworks: "makes life easier for people who want to program for the browser."
jQuery是一个框架,但不是唯一的框架。另一个JS框架是AngularJS、Mootools、NodeJS、BackboneJS等。对于这些框架中的任何人,您都将执行纯JS无法执行的任何操作,或者任何“复杂”(我找不到正确的词)操作。正如Void所说,他将他的回答与我关于框架的回答相一致:“对于那些想为浏览器编程的人来说,这让事情变得更容易。”
-
With AJAX you can communicate your Web page to the server. AJAX depends on JS to work.
使用AJAX,您可以将Web页面与服务器通信。AJAX依赖于JS来工作。
#8
-7
Javascript is a scripting language, Not a programing language. Jquery and ajax are simplified version of javascript which helps manupulate queries of certain part of website without having to change the entire user interface of the website.
Javascript是一种脚本语言,不是编程语言。Jquery和ajax是javascript的简化版本,它帮助管理网站某些部分的查询,而无需更改网站的整个用户界面。