Jquery

xiaoxiao2025-11-02  3

正课:

ajax

跨域:*****

ajax $.ajax({ url:" … ", type: “get”|“post”, data:“变量=值&…”|{变量:值,…}, dataType:“json”, success:function(res){ //在响应成功结束后自动 //res就是响应的结果 }, error(){ 当请求出错时,自动触发 }, complete(){ 无论成功还是出错,只要请求结束就执行 } }) 3.x .then(function(res){ … })

跨域: 什么是: 一个域名下的网站,请求另一个域名下的网站的资源 问题: ajax禁止发送跨域请求! 以下情况不允许发送ajax请求:

http://www.tedu.com ajax-> http://www.tmooc.cn

http://oa.tedu.com ajax-> http://hr.tedu.com

http://localhost:3000 ajax-> http://localhost:8000

https://baidu.com ajax-> http://baidu.com 443 80

http://localhost ajax-> http://127.0.0.1 如何跨域访问: 2种:

JSONP,需要客户端与服务端配合 什么是:填充式JSON——JSON with Padding 何时: 今后跨域,首选jsonp 如何: 基本思想:用其它可以跨域请求的元素,代替ajax 程序中都是用

转载请注明原文地址: https://www.6miu.com/read-5038929.html

最新回复(0)