Now we're ready to retrieve the list of latest posts and process them, making them ready to be displayed as items in the marquee. In order to access this data across the Internet from another domain, we need to use JSONP, which stands for JSON with Padding, and involves dynamically creating and injecting a <script>
element to the page, although jQuery actually handles this aspect of it for us.
jQuery provides native support for JSONP and allows us to bypass the same-origin security policy of the browser. In order to output JSON in the correct format, I'm using the JSON API plugin on a WordPress-powered blog, which outputs JSON in the following format:
{ "status": "ok", "count": 1, "count_total": 1, "pages": 1, "posts": [ { "id": 1, etc... }, { "id": 2, Etc... } ] }
There are more properties in the posts array shown in the previous code block, as well as other arrays and properties in...