Advertisement
pusatdata

Embed Artikel Wikipedia

Aug 2nd, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. HTML:
  2. <div id="article"></div>
  3.  
  4. JS:
  5. $(document).ready(function(){
  6.  
  7. $.ajax({
  8. type: "GET",
  9. url: "http://id.wikipedia.org/w/api.php?action=parse&format=json&prop=text&page=Pembrita_Betawi&callback=?",
  10. contentType: "application/json; charset=utf-8",
  11. async: false,
  12. dataType: "json",
  13. success: function (data, textStatus, jqXHR) {
  14.  
  15. var markup = data.parse.text["*"];
  16. var blurb = $('<div></div>').html(markup);
  17. $('#article').html($(blurb).find('p'));
  18.  
  19. },
  20. error: function (errorMessage) {
  21. }
  22. });
  23. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement