-
-
Save rainbat/1243d752b85f5c0fc8c92edcfd5773e8 to your computer and use it in GitHub Desktop.
Wordpress loop Posts using jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<h1>Show Adds via JSON Rest Query</h1> | |
<script> | |
(function($) { | |
$(document).ready(function(){ | |
$.getJSON("https://www.rainbat.ch/wp-json/wp/v2/inserat/?json=1",function(data) { | |
console.log(data); | |
$.each(data, function(k, v) { | |
$('body').append( '<h3>' + v.title.rendered + '</h3>' ); | |
$('body').append( '<p>' + v.content.rendered + '</p>' ); | |
}); | |
}); | |
}); | |
})(jQuery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment