I'm working on creating a Polymer element that can showcase WordPress articles. Here is the Json File which contains all the posts.
My current code snippet:
<link rel="import" href="../bower_components/polymer/polymer.html">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<polymer-element name="wordpress-post" attributes="from">
<template>
<h1>Test</h1>
</template>
<script>
Polymer('wordpress-post', {
ready: function () {
alert(this.from);
$.ajax({
type: "GET",
url: "http://www.jsv-lippstadt.de/?json=get_category_posts&slug=" + this.from,
dataType: 'jsonp',
error: function () {
alert('Unable to load feed, Incorrect path or invalid feed');
},
success: function (data) {
console.log(data);
var arr = $.map(data, function(el) { return el; })
console.log(arr);
}
});
},
})
</script>
The output of this code is a JavaScript Array printed in the console (console.log(arr)).
I need help with looping through this array and displaying the posts using Polymer. Can anyone provide guidance on how to achieve this? Thank you!