Ajax 请求
ajax 请求解析josn
其实代码很简单,主要是怎么模拟测试数据,例如在GitHub page上建个data.json我们请求
https://naiop.github.io/test/data.json
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Ajax请求</title> </head> <body> <h2>打开控制台查看详情</h2> </body> <script src="https://common.cnblogs.com/scripts/jquery-2.2.0.min.js"></script> <script> $(function(){ console.log("Ajax"); $.ajax({ type: "GET", url: "https://naiop.github.io/test/data.json", dataType: "json", success: function (res) { console.log(res); }, error: function (err) { console.log(err); } }); }); </script> </html>
本文作者:浅绿色i
本文链接:https://www.cnblogs.com/xfweb/p/15218279.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步