我能否知道Javascript,Jquery和Ajax之间的区别? [英] Can I Know The Difference Between Javascript , Jquery, And Ajax

查看:48
本文介绍了我能否知道Javascript,Jquery和Ajax之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以知道javascript,jquery和ajax之间的区别



以及我们应该在哪里使用这些......在代码中



给我一个明确的想法,请不要给我链接



提前感谢,

< br b>

解决方案

编程语言 主要用于 webpages 使网站互动。当浏览器解析网页 时,它会创建页面的内存中表示。 树结构,它包含页面上的所有元素。所以一个根元素,它包含head和body元素,其中包含其他元素,其中包含其他元素。所以它看起来像一棵树。现在使用javascript,您可以使用 操作页面 树。您可以通过其id(getElementsById)或其标记名称(getElementsByTagName),或通过简单地遍历树(parentNode,firstChild,lastChild,nextSibling,previousSibling等)来选择元素。一旦您有了可以使用的元素,您可以通过更改页面上的外观,内容或位置来修改它们。此接口 也称为 DOM (Document Object Model)。所以你可以使用其他编程语言可以的Javascript以及使用嵌入到 wepages中你还获取内存中的 Object ,您可以通过该网页以交互方式更改页面。

AJAX 浏览器与页面内服务器之间的通信技术。聊天 是一个很好的例子。您可以在不离开页面的情况下编写消息,发送消息并重新接收其他消息。您可以在客户端使用Javascript管理交互,使用 XMLHTTP 对象由浏览器提供。

jQuery 一个库,旨在简化客户端Web开发 general (另外两个)。它创建了一个抽象层,因此您可以在
Javascript中重用CSS和HTML 等常用语言。它还包括可以非常容易地与服务器通信的功能(AJAX)。 Javascript中编写 所有 你,只会使常见任务更容易。它还隐藏了一些浏览器的误解和错误。


简单来说,



1. Javascript:这是一种设计用于在Web浏览器中使用的语言。服务器呈现网页后,会将其发送到Web浏览器。如果没有javascript,页面中的任何更改都必须由服务器端代码完成,这意味着网页必须向服务器发出请求。但是使用javascript,可以使用Web浏览器中的可用数据修改网页,而无需调用服务器。避免服务器调用意味着快速处理请求。



2. Jquery:Jquery只不过是javascript。它就像用javascript编写的类库。开发Jquery是为了简化javascript代码。它以简单直观的方式实现了javascript中最常用的功能。此外,jquery最重要的一点是跨浏览器支持。并非所有浏览器都支持相同的javascript版本,你在如何为IE和firefox编写javascript方面存在一些差异,但是jquery为你处理这些差异,所以你不必担心浏览器支持。它适用于所有浏览器。





3. Ajax:Javascript可用于向服务器发出请求并接收响应。但是这种类型的服务器调用非常繁琐,因此jquery实现了一个名为Ajax的函数,它可以为您完成。您只需要在一行中编写简单的ajax函数,然后为您完成剩下的工作。



为了使用jquery或ajax,你需要在你的网站中包含jquery库。但是对于使用javascript你不需要这样做。



P.S.还有更多的讨论差异和为什么使用一个而不是另一个,但我希望这些简单的点让你领先主题。如果您有任何具体问题,请告诉我。


如果您需要,可以参考这篇CP帖子..它包含一些很好的解决方案



JavaScript,JQuery,Jason,AJAX之间的区别 [ ^ ]

can i know the difference between javascript , jquery, and ajax

and where we should use these... in code

give me the clear idea , don't give me links please

thanks in advance,

Velsamy

解决方案

Javascript is a programming language which is used mainly in webpages for making websites interactive. 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.

AJAX is a technique of communication between the browser and the server within a page. Chat is a good example. You write a message, send a message and recive other messages without leaving the page. You can manage this interaction with Javascript on the client side, using an XMLHTTP Object provided by the browser.

jQuery is a library which aims to simplify client side web development in general (the two other 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.


To put it in simple terms,

1. Javascript: It is a language designed for use with in the web browser. After server renders a webpage, it send it to the web browser. Without javascript any change in the page has to be done by the server side code which means the webpage has to make a request to the server. But with javascript, the webpage can be modified with the available data in the web browser without making a call to the server. Avoiding server calls means requests are processed quickly.

2. Jquery: Jquery is nothing but javascript. It is like class library written in javascript. Jquery is developed to simplify the javascript code. It implements the most commonly used functions in javascript with a simple and intuitive way. Also the most important point of jquery is cross browser support. Not all browser supports the same javascript versions, there are some difference in how you write javascript for IE and firefox but jquery handles these differences for you so you need not worry about the browser support. It works in all browsers.


3. Ajax: Javascript can be used to make a request to server and receive response. But this type of server call is quite tedious so jquery has implemented a function called Ajax which does it for you. You just need to write simple ajax function in one line and it does the rest for you.

In order to use jquery or ajax you need to include jquery library in your website. But for working with javascript you need not do this.

P.S. There are more to talk about the differences and why use one over the other but I hope these simple points get you a head start with the topics. Please let me know if you have any specific questions.


If you want you can refer this CP post..it contains some good solutions

Difference between JavaScript,JQuery,Jason,AJAX[^]


这篇关于我能否知道Javascript,Jquery和Ajax之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆