企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
http.js ``` class HTTP { request({ url, type = "get", dataType }) { return $.ajax({ url, type, dataType }) } } class MovieModel extends HTTP{ getTop250(){ return this.request({ url:"https://api.douban.com/v2/movie/top250", dataType:"jsonp" }) } } ``` index.js ``` <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://api.douban.com/v2/movie/top250", dataType:"jsonp", success: res=>{ console.log(res) } }) </script> ```