为什么叫 XMLHttpRequest?

2023-05-15前端开发问题
1

本文介绍了为什么叫 XMLHttpRequest?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我一直想知道为什么这个对象被这样称呼?

I always wonder why this object is called like that?

您的请求正文不需要是 XML 格式.此外,从服务器接收的数据可以以 JSON、XML、HTML 或纯文本的形式获取.XML 在这个对象中并不重要.这是某种陈词滥调吗?这个对象最初创建时是什么?

The body of your request does not need to be in XML format. Also, data received from server can be fetched as JSON, XML, HTML, or plain text. XML does not play an essential part in this object. Is this some kind of a cliché? What is this object used to be when it was first created?

推荐答案

XMLHttpRequest 是由 Microsoft 的 Outlook Web Access 团队发明的.这个高度创新的团队之前给了我们远程脚本,这是AJAX"风格开发的开始.远程脚本类似于 JSONP,但过于复杂(它使用 Java 小程序,最重要的是).我不记得是否可以在 IE 4 或 5 中动态注入 <script> 元素,但这似乎是不可能的.否则,JSONP 似乎足够强大,可以消除对 XMLHttpRequest 的需求.

XMLHttpRequest was invented by Microsoft's Outlook Web Access team. This highly innovative team previously gave us remote scripting, which was the the beginning of "AJAX" style development. Remote scripting was like JSONP, but overly complicated (it used a Java applet, of all things). I don't remember whether it was possible to dynamically inject <script> elements in IE 4 or 5, but it seems like that wasn't possible. Otherwise, JSONP seems powerful enough to eliminate the need for XMLHttpRequest.

Outlook 团队正在将 XML 从服务器传输到客户端,因此命名 ActiveX 控件以反映其当时的主要用途.它被包含在 MSXML 解析器中.

The Outlook team was transferring XML from server to client, so the ActiveX control was named to reflect its primary use at the time. It was included as part of the MSXML parser.

当 Firefox 进入游戏并实现他们自己的版本时,XMLHttpRequest 的使用更像今天,而用于 XML 的则更少,但 Firefox 还是使用了相同的名称.由于两家最大的浏览器制造商创建了一个具有相同名称、界面和功能的对象,w3c 坚持使用现有名称.太糟糕了,有人没有对这个误称更恶毒,并坚持我们称它为更准确的东西,比如 HttpRequest.

By the time Firefox got in on the game and implemented their own version, XMLHttpRequest was being used more like it is today, and less for XML, but Firefox used the same name anyway. With the two biggest browser makers creating an object with the same name, interface, and functionality, the w3c stuck with the existing name. It's too bad someone didn't make more of a stink about the misnomer and insist we call it something more accurate like just HttpRequest.

我不知道AJAX"是如何或为什么成为一个流行的术语来描述网页与服务器交互而不需要完整的页面加载的编程风格.与XMLHttpRequest"相比,AJAX"用词不当,因为它不仅暗示 XML 是一个重要方面,而且还没有提供服务器交互的指示.我可以使用 JavaScript 异步处理 XML,而无需与服务器通信.

I don't know how or why "AJAX" became the popular term to describe the programming style where a web page interacts with the server without requiring a complete page load. "AJAX" is a worse misnomer than "XMLHttpRequest" since it not only implies XML is an essential aspect, but further provides no indication of server interaction. I can process XML with JavaScript asynchronously without ever communicating with a server.

这篇关于为什么叫 XMLHttpRequest?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

ajax请求获取json数据并处理的实例代码
ajax请求获取json数据并处理的实例代码 $.ajax({ type: 'GET', url: 'https://localhost:44369/UserInfo/EditUserJson',//请求数据 data: json,//传递数据 //dataType:'json/text',//预计服务器返回的类型 timeout: 3000,//请求超时的时间 //回调函数传参 suc...
2024-11-22 前端开发问题
215

js删除数组中指定元素的5种方法
在JavaScript中,我们有多种方法可以删除数组中的指定元素。以下给出了5种常见的方法并提供了相应的代码示例: 1.使用splice()方法: let array = [0, 1, 2, 3, 4, 5];let index = array.indexOf(2);if (index -1) { array.splice(index, 1);}// array = [0,...
2024-11-22 前端开发问题
182

layui 单选框、复选框、下拉菜单不显示问题如何解决?
1. 如果是ajax嵌套了 页面, 请确保 只有最外层的页面引入了layui.css 和 layui.js ,内层页面 切记不要再次引入 2. 具体代码如下 layui.use(['form', 'upload'], function(){ var form = layui.form; form.render(); // 加入这一句});...
2024-11-09 前端开发问题
313

JavaScript小数运算出现多位的解决办法
在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会...
2024-10-18 前端开发问题
301

JavaScript(js)文件字符串中丢失"\"斜线的解决方法
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转...
2024-10-17 前端开发问题
437

layui中table列表 增加属性 edit="date",不生效怎么办?
如果你想在 layui 的 table 列表中增加 edit=date 属性但不生效,可能是以下问题导致的: 1. 缺少日期组件的初始化 如果想在表格中使用日期组件,需要在页面中引入 layui 的日期组件,并初始化: script type="text/javascript" src="/layui/layui.js"/scrip...
2024-06-11 前端开发问题
455