wordpress 的rest api 需要wp设置长链接才可以, 不能设置 ?P=2 这种链接,需要是localhost/postname这种链接;
$.getJSON(url,x ) 有两个参数,第一个是响应的网站链接,第二个是执行的callback函数;如: getResults() { $.getJSON(‘http://milad.com.cn/wp-json/wp/v2/posts?search=things’,function(posts) { alert(posts[0].title.rendered); }); this.isSpinnerVisable = false; }