AJAX principle (XMLHttpRequest+Promise+URLSearchParams)

1. XMLHttpRequest The XMLHttpRequest (XHR) object is used to interact with the server. Through XMLHttpRequest, a specific URL can be requested to obtain data without refreshing the page. This allows the web page to update partial content of the page without affecting the user’s operation. XMLHttpRequest is heavily used in AJAX programming. Relationship: Axios internally […]

Asynchronous request-XMLHttpRequest, ajax, axios principle analysis

Asynchronous request-XMLHttpRequest, ajax, axios principle analysis XMLHTTPRequest refer to readyState responseType XMLHttpRequest Level 1 XMLHttpRequest Level 2 polling Regular polling long polling Ajax refer to Imitate ajax package xmlHttpRequest axios refer to What are the features of axios? implement axios XMLHTTPRequest Reference XML and Ajax readyState value status description 0 UNSENT (unopened) Indicates that the […]

Front-end cross-domain mainstream solution (Access to XMLHttpRequest at ‘http..’ from origin ‘null’ has been blocked by CORS policy)

Question background The front-end and back-end are developed separately. Due to the same-origin policy of the browser itself (the server does not have this restriction), cross-domain will occur when the front-end accesses the server-side interface. Classic error: Access to XMLHttpRequest at ‘http…’ from origin ‘null’ has been blocked by CORS policy Solution: Note: There are […]

Use XMLHttpRequest to read and manipulate svg graphs in vue (control dom flickering)

<template> <div class=”this_bk”> <div id=”svgTemplate” ref=”svg”></div> </div> </template> <script> import wftSvg from “@/assets/svg/xxmap.svg”; export default { data() { return { svgDom: null, allDom: null, } }, created() { this. getSvg(); }, mounted() { // svg mouse scroll event window[‘havcZooming’] = (e) => { console.log(e, ‘havcZooming—–>>>’) this. zoomimg(); } }, methods: { getSvg() { let _this […]

XMLHttpRequest (AJAX)

1. Introduction to AJAX AJAX is a conventional method for accessing web pages. It is the abbreviation of Asynchronous JavaScript and XML. It refers to asynchronous communication through JavaScript, obtaining XML documents from the server to extract data from them, and then updating the corresponding part of the current web page without refreshing the entire […]

[Solved] Vue cross-domain problem solving: Access to XMLHttpRequest at’httplocalhost

I encountered a cross-domain problem two days ago, and reported the error of Access to XMLHttpRequest at’httplocalhost. I found some information on the Internet. I implemented it by configuring vue.config.js and proxy. It feels very convenient and I will share it with you! I. Background supplement (jsonp) First of all, a background, why does cross-domain […]