多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## ``` <input type="text" placeholder="你的名字"> <button>搜索</button> <h1></h1> <img src="" alt=""> <p></p> ``` ### 简单封装代码 ``` <script> var baseUrl = "https://douban.uieee.com/v2/movie/" function http({ url, success }) { $.ajax({ url: baseUrl + url, dataType: "jsonp", success: res => { success(res) } }) } $("button").click(function () { var value = $("input").val(); http({ url: `search?q=${value}&count=1`, success: res => { var title = res.title; var imgUrl = res.subjects[0].images.small; var id = res.subjects[0].id; $("h1").html(title); $("img").attr("src", imgUrl) http({ url: id, success: res => { var summary = res.summary; $("p").html(summary) } }) } }) }) </script> ```