Ajax
CodeBoyWLC
技术+原理爱好者
展开
-
【Ajax】跨域:设置CORS响应头实现跨域
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>CORS</title> <style> #result{ w原创 2021-05-17 19:09:39 · 313 阅读 · 0 评论 -
【Ajax】Axios发送ajax请求
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>axios 发送 AJAX请求</title> <script crossorigin="anonymou原创 2021-05-17 19:08:28 · 71 阅读 · 0 评论 -
【Ajax】jQuery发送ajax请求
//1. 引入expressconst express = require('express');//2. 创建应用对象const app = express();//3. 创建路由规则:app.all('/server', (request, response) => { //设置响应头: 设置允许跨域 response.setHeader('Access-Control-Allow-Origin', '*'); response.setHeader('Access原创 2021-05-17 19:06:06 · 109 阅读 · 0 评论 -
【Ajax】重复发送请求问题的解决
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>重复请求问题</title></head><body> <button>点原创 2021-05-17 19:04:22 · 111 阅读 · 0 评论 -
【Ajax】中断请求
//1. 引入expressconst express = require('express');//2. 创建应用对象const app = express();//3. 创建路由规则:app.all('/delay', (request, response) => { //设置响应头: 设置允许跨域 response.setHeader('Access-Control-Allow-Origin', '*'); setTimeout(() => { //服务原创 2021-05-17 19:03:14 · 241 阅读 · 0 评论 -
【Ajax】请求超时、无网络问题
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>请求超时与网络异常</title> <style> #result{原创 2021-05-17 19:02:01 · 437 阅读 · 0 评论 -
【Ajax】服务器端返JSON数据
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>JSON响应</title> <style> #result{原创 2021-05-17 19:00:21 · 110 阅读 · 0 评论 -
【Ajax】发送POST请求
//1. 引入expressconst express = require('express');//2. 创建应用对象const app = express();//3. 创建路由规则:all即可以接收任意类型的请求app.all('/server', (request, response) => { //设置响应头: 设置允许跨域 response.setHeader('Access-Control-Allow-Origin', '*'); //响应头属性,与值原创 2021-05-17 18:58:18 · 100 阅读 · 0 评论 -
【Ajax】简单客户端+服务器交互
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <title>AJAX GET 请求</title> <style> #result{原创 2021-05-17 18:56:23 · 202 阅读 · 0 评论 -
【Ajax】创建个服务器:接收客户端的请求
//1. 引入expressconst express = require('express');//2. 创建应用对象const app = express();//3. 创建路由规则app.get('/', (request, response)=>{ //设置响应:为响应体 response.send('HELLO EXPRESS');});//4. 监听端口启动服务app.listen(8000, ()=>{ console.log("服务已原创 2021-05-17 18:54:33 · 94 阅读 · 0 评论