AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
## 1. ajax本身就是一个promise > 在html页面引入不能用import,所以不需要export,可直接用script导入,即可调用 - http.js ``` class HTTP { request({url,type="get",dataType}){ return $.ajax({ url, type, dataType, }) } } class MovieModel extends HTTP{ getTop250(){ return this.request({ url:"https://douban.uieee.com/v2/movie/top250", dataType:"jsonp" }) } } ``` - html ``` <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script> <script src="http.js"></script> <script> var http = new HTTP() http.request({ url:"https://douban.uieee.com/v2/movie/top250", dataType:"jsonp", }).then(res=>{ console.log(res) }) </script> ``` ``` var movie = new MovieModel() movie.getTop250().then(res=>{ console.log(res) }) ```