Files
ClassContent/历届学生/fontendseven/每天课程/2021-11-26/笔记.txt
2024-09-27 02:06:13 +08:00

30 lines
601 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ajax 主要是前后端数据交互的一种方式(通讯技术)
单向通讯技术
前端 ----> 后端
ajax 同源策略 跨域(Access-Control-Allow-Origin)
协议
域名
端口
前端:http://127.0.0.1:8000/api/demo/js
后端:http://127.0.0.1:3000/api/json/index
解决 跨域
1:cors 后端设置请求头(Access-Control-Allow-Origin),允许跨域
2:jsonp,通过js资源文件请求,绕过同源策略,再加上callback拿回数据 是js文件请求,不是ajax
3:后端代理
get
http://127.0.0.1/my.php?id=1&page=2&num=10
post
请求体