如何使用jQuery从WordPress的JSON对象中提取数据

时间:2019-06-14 20:01:34

标签: jquery json wordpress

我有具有结果的json对象,但问题是我无法将数据加载到div中,这是我的json

{
  "userScreen": "rashisalabo",
  "userName": "\u53e4\u5ddd\u7d75\u7f8e",
  "tweetCreated": "2019-05-22 11:26:13",
  "tweetText": "\u7c73\u4eba\u6750\u7cfb\u60c5\u5831\u30b5\u30a4\u30c8\u304c\u3001\u3055\u307e\u3056\u307e\u306a\u8077\u696d\u306e\u53ce\u5165\u3084\u52b4\u50cd\u74b0\u5883\u3001\u30b9\u30c8\u30ec\u30b9\u3001\u6210\u9577\u6027\u306a\u3069\u3092\u30b9\u30b3\u30a2\u5316\u3057\u3066\u30e9\u30f3\u30ad\u30f3\u30b0\u5316\u3057\u305f\u300cThe 2018 Jobs Rated Report\u300d\u3067\u3001\u30e9\u30f3\u30ad\u30f3\u30b0\u30c8\u30c3\u30d7\u306f\u907a\u4f1d\u30ab\u30a6\u30f3\u30bb\u30e9\u30fc\u3067\u30012\u4f4d\u6570\u5b66\u8005\u30013\u4f4d\u5927\u5b66\u6559\u6388\u2026 https:\/\/t.co\/AS7cTUspbE",
  "tweetRetweetCt": "0",
  "tweetFavoriteCt": "0"
}

这是我尝试将json转换并加载到div中的代码。

 $.post(c, {page:p, action: "my_loadmore"}, function(data) {

  console.log(data.userScreen);

$("#left-area").append('<article id="mypost" class="et_pb_post post-29 post type-post status-publish format-standard hentry category-uncategorized"><div class="TweetMasonry__topbar"><a href="http://jobplace360.com/2019/04/26/abc/" class="topbarName">'+ data +'</a></div></article>');

});
   }

0 个答案:

没有答案