ajax应用

AJAX has several benefits that can be utilized inside a web application. In this article, we'll explore some advantages of AJAX and see some of its applications.

AJAX具有可在Web应用程序内部使用的多个优点。 在本文中,我们将探讨AJAX的一些优势,并了解其一些应用

编写回调 (Writing Callbacks)

Recall that a simple callback function is just one function calling another one by taking the latter as a parameter. We can use AJAX to make a callback in many applications without waiting for the page to respond with the data. Now, this has an advantage when it comes to building an application that runs fast and smoothly thereby providing great user experience. The network speeds up and performance becomes better because the network utilization is considerably reduced. Similarly, if a website has a restricted bandwidth, it considerably boosts up. This is a great exploitation of the fact that many times writing AJAX requests we only need a small amount of data for our application. It doesn't make sense to have a large response time for minimal data. The response time, network load and speed should be in accordance with the kind and amount of data we're taking in.

回想一下,简单的回调函数只是一个将另一个作为参数调用的函数。 我们可以使用AJAX在许多应用程序中进行回调,而无需等待页面响应数据。 现在,这对于构建快速且平稳运行的应用程序具有优势,从而提供了出色的用户体验。 由于网络利用率大大降低,因此可以加快网络速度并提高性能。 同样,如果网站的带宽受到限制,则可以大大提高网站的带宽。 这是对以下事实的一种很好的利用:多次编写AJAX请求,我们的应用程序只需要少量数据。 响应时间长,数据量少是没有意义的。 响应时间,网络负载和速度应与我们要接收的数据的种类和数量一致。

进行异步调用 (Making Asynchronous Calls)

The asynchronous behavior of an application is the magic behind single-page applications. These days modern applications have a single page with multiple functions that are undisturbed when the process is fetching data from a server is going on the background. These asynchronous calls can be made with Ajax to a backend, API or a server. As a user, we never have to wait for that data to come back for seeing other pages on the website or seeing some content.

应用程序的异步行为是单页应用程序背后的魔力。 如今,现代应用程序只有一个页面,其中包含多个功能,而这些功能在后台从服务器获取数据的过程中不受干扰。 可以使用Ajax对后端,API或服务器进行这些异步调用。 作为用户,我们无需等待数据返回就可以看到网站上的其他页面或看到某些内容。

Alright so AJAX is used to write callbacks and making async calls, but where are these benefits utilized?

好的,所以AJAX用于编写回调和进行异步调用,但是这些好处在哪里得到利用?

1)登录表格 (1) Login forms)

Working with AJAX in login forms is a great way to understand it's an advantage. We create a simple login form and attach an event listener to our submit event. When this event is triggered, we make an AJAX call to our database and check for valid user credentials. All of this without the slightest need to steer away from the current page or reloading the pageA popular site like Digg has a login system that works this way.

以登录表单使用AJAX是了解它的一个好方法。 我们创建一个简单的登录表单,并将事件侦听器附加到我们的Submit事件。 触发此事件后,我们将对数据库进行AJAX调用,并检查有效的用户凭据。 所有这些都完全不需要转向当前页面或重新加载页面。像Digg这样的受欢迎的网站都具有以这种方式工作的登录系统。

2)自动完成 (2) Autocomplete)

Google was one of the first major companies to start using AJAX. When google's search engine tool came out everyone was talking about it. You must have not noticed that the autocomplete feature inside their engine was dynamic even back then, courtesy of AJAX. When typing into the Google search bar, it starts to use AJAX to get common results from the database on each keystroke. Even now you can use AJAX to add auto-complete features on your web application easily. This is also implemented in many UI Libraries which give us the autocomplete feature using an inbuilt plugin but inside it's simple AJAX callback working on the autocomplete feature.

Google是最早使用AJAX的主要公司之一。 当Google的搜索引擎工具问世时,所有人都在谈论它。 您可能还没有注意到,即使在那时,其引擎内的自动完成功能还是动态的,这要归功于AJAX。 在Google搜索栏中键入内容时,它将开始使用AJAX在每次击键时从数据库中获取常见结果。 即使现在,您也可以使用AJAX在Web应用程序上轻松添加自动完成功能。 许多UI库中也实现了此功能,这些库使用内置插件为我们提供了自动完成功能,但是在内部,简单的AJAX回调在其中使用了自动完成功能。

3)动态更新内容 (3) Dynamically updating content)

It shouldn't be a surprise that popular social media platforms established their dominance on the web by showing the user's feed, comments, posts, etc dynamically without the need to refresh the page. The AJAX engine would fetch data in real-time and show it to the user. This is how the page would update content dynamically and offers a great user experience.

流行的社交媒体平台无需刷新页面即可动态显示用户的供稿,评论,帖子等,从而在网络上占据统治地位,这不足为奇。 AJAX引擎将实时获取数据并将其显示给用户。 该页面将以这种方式动态更新内容并提供出色的用户体验。

4)聊天应用 (4) Chatting applications)

Long ago, back when instant messaging had just come out and had started gaining immense popularity, most online chat rooms and chat apps were using AJAX requests for the complete functioning of their chatting applications.

很久以前,当即时消息传递刚刚开始并开始受到极大欢迎时,大多数在线聊天室和聊天应用程序都使用AJAX请求来实现其聊天应用程序的完整功能。

5)小部件和添加 (5) Widgets and adds)

Widgets were super popular back then just as much as ads are these days. You must have noticed a lot of times adds on a website changes after some time and all of this happens while you have been on the same page for the last 15 minutes doing possibly nothing but read out some wiki information that you need. You never clicked anywhere, never reloaded the page, the network speed was fantabulous. In such a situation if the page just out of nowhere grabs some data and updates it, while you're in awe wondering wasn't there an advertisement of mind valley here before? Now there's one for Mitashi. All of this because of AJAX callbacks and asynchronous AJAX requests.

窗口小部件在当时非常流行,就像现在的广告一样。 您一定已经注意到,一段时间后,网站上的很多次更改都发生了,而所有这一切都是在您过去15分钟一直在同一页面上时发生的,除了读出所需的一些Wiki信息外,可能什么也没有做。 您从来没有单击过任何地方,也从未重新加载过页面,网络速度异常惊人。 在这种情况下,如果页面无处不在获取一些数据并对其进行更新,而您却对此感到敬畏,那么您是否想知道这里是否曾有过广告宣传? 现在,三菱有一个。 所有这些都是由于AJAX回调和异步AJAX请求。

Reference: How AJAX Works: 10 Practical Uses For AJAX

参考: AJAX的工作原理:AJAX的10种实际用途

翻译自: https://www.includehelp.com/ajax/applications.aspx

ajax应用

ajax应用_AJAX的应用相关推荐

  1. php mysql ajax 分页_ajax+php+mysql无刷新分页代码(1/2)_PHP教程

    ajax+php+mysql无刷新分页代码 ajax+php教程+mysql教程无刷新分页代码 2 3 4投票结果 5 6 7 8 9 function getxmlhttpobject() 10 { ...

  2. 和ajax区别_AJAX、Fetch和Axios的细微区别

    前端技术真的是一个发展非常飞快地领域,现在只知道原生的XHR和Jquery AJAX是不能满足开发的需求的,现在axios和fetch已经开始抢占"请求"这个前端高地了,今天就给阐 ...

  3. java ajax定义_Ajax的定义

    Ajax的定义 Ajax不是一个技术,它实际上是几种技术,每种技术都有其独特这处,合在一起就成了一个功能强大的新技术.Ajax包括: XHTML和CSS 使用文档对象模型(Document Objec ...

  4. java ajax教程_AJAX Java

    AJAX Java 需求:完成一个异常获取后台服务器的当前时间. 一.页面制作一个按钮 当前服务器的时间为: 二.编写JS异步提交请求后台 window.onload = function(){ do ...

  5. 妙味课堂ajax教程,妙味课堂JS高级专题篇视频资料分享

    <妙味课堂JS高级专题篇视频教程>将向大家详细介绍javascript,javascript是一种直译式脚本语言,也是一种广泛用于客户端Web开发的脚本语言.目前,被数百万计的网页用来改进 ...

  6. C#进阶系列——WebApi 身份认证解决方案:Basic基础认证

    阅读目录 一.为什么需要身份认证 二.Basic基础认证的原理解析 1.常见的认证方式 2.Basic基础认证原理 三.Basic基础认证的代码示例 1.登录过程 2./Home/Index主界面 3 ...

  7. jquery extend函数

    JS组件系列--封装自己的JS组件,你也可以 前言:之前分享了那么多bootstrap组件的使用经验,这篇博主打算研究下JS组件的扩展和封装,我们来感受下JQuery为我们提供$.Extend的神奇, ...

  8. JS组件系列——封装自己的JS组件,你也可以

    前言:之前分享了那么多bootstrap组件的使用经验,这篇博主打算研究下JS组件的扩展和封装,我们来感受下JQuery为我们提供$.Extend的神奇,看看我们怎么自定义自己的组件,比如我们想扩展一 ...

  9. (转)C# WebApi 身份认证解决方案:Basic基础认证

    原文地址:http://www.cnblogs.com/landeanfen/p/5287064.html 阅读目录 一.为什么需要身份认证 二.Basic基础认证的原理解析 1.常见的认证方式 2. ...

最新文章

  1. Sql Server 调用DLL
  2. 如果在chrome的新标签中继续打开开发工具
  3. 覆盖 19 个城市,19,000 个样本,零售业深度研究报告发布
  4. 自定义线程池-java内置线程池构造方法介绍
  5. 牛客练习赛69C-旅行【结论,最大生成树】
  6. LeetCode 650. 只有两个键的键盘(DP)
  7. Oracle 11g 间隔分区(INTERVAL)批量规范命名
  8. Java作业-多线程
  9. Blazor确认复选框组件
  10. CSS样式切换技巧 - 动态更换网页色彩皮肤
  11. 【图像重建】基于matlab GUI投影法图像重建【含Matlab源码 861期】
  12. matlab 短时傅立叶变换,Matlab中短时傅里叶变换 spectrogram和stft的用法
  13. HBuilderX踩坑记录(1)—— vivo iqoo z1开启adb调试
  14. word流程图变为图片格式_图片如何转换成word?新手小白几步就学会了
  15. mac上使用nginx代理
  16. GIS在地质灾害危险性评估与灾后重建中的实践技术应用及python机器学习灾害易发性评价模型建立与优化
  17. 连接Wifi时自动弹出登录页面是如何做到的?
  18. 北京2017年7月开始 社保最低缴费
  19. python的读后感_Python读书笔记
  20. 更改Gradle镜像下载地址

热门文章

  1. python爬虫爬取音乐单曲_Python爬取qq音乐的过程实例
  2. php函数内的循环,PHP 循环列出目录内容的函数代码
  3. caffe运行不停止_caffe(gpu)安装过程及问题解决
  4. linux修改栈指针x86,为什么x86-64 Linux系统调用会修改RCX,这个值意味着什么?
  5. 一些adb的常用命令
  6. PAT (Advanced Level) 1038. Recover the Smallest Number (30)
  7. C++primer习题--第3章
  8. 基于Fragment的百度地图框架的使用
  9. Lync2013 升级错误总结8 Lync2013 日志总是提示进程 RtcHost(5724) 收到了一个无效的客户端证书...
  10. Linux下系统与硬件时钟管理