Hello all,
I got a small question wich got me stuck.
I got a HTML page with javascript which im using to retreive a list of authors of my wordpress blogwebsite:
HTML:
Using the following JSON script:Code:<div data-role="content" id="authorlist"> <!-- A list of all the authors of the wordpress page. --> </div>
Which uses the following javascript:Code:<script src="http://bloggingaboutoracleapplications.org?json=get_author_index&callback=listAuthors" type="text/javascript"></script>
Which results in a nice looking author page:Code:function listAuthors(data){ //Alle Authors ophalen var output='<ul data-role="listview" data-filter="true">'; $.each (data.authors, function(key,val) { var tempDiv = document.createElement("tempDiv"); tempDiv.innerHTML = val.excerpt; $("a",tempDiv).remove(); var excerpt = tempDiv.innerHTML; output+='<li>'; output+='<a href="#postsFromAuthors" onclick="postsFromAuthors(' + val.id + ')" >'; output+='<h3>' + val.name + '</h3>'; output+='<p>' + val.description + '</p>'; output+='</a>'; output+='</li>'; }); //Go through each author output+='</ul>'; $('#authorlist').html(output); }
http://s8.postimage.org/7arxinxut/authorlist.png
The following step would be to click on a person in this list and retreive all the blog posts this person has writen.
As you could see, i call the following function for this: #postsFromAuthors"
Which uses the following Javascript:
And the corresponding HTML:Code:function postsFromAuthors(id){ //Alle posts ophalen van de geselecteerd author var output='<ul data-role="listview" data-filter="true">'; $.getJSON('http://bloggingaboutoracleapplications.org/?json=get_author_posts&id=' + id + '&callback=?', function (data) { $.each(data.posts,function(key,val) { var tempDiv = document.createElement("tempDiv"); tempDiv.innerHTML = val.excerpt; $("a",tempDiv).remove(); var excerpt = tempDiv.innerHTML; output+='<li>'; output+='<a href="#blogpost" onclick="showPost(' + val.id + ')">'; output+='<h3>' + val.title + '</h3>'; output+='<p>' + excerpt + '</p>'; output+='</a>'; output+='</li>'; output+='</ul>'; $('#listFromAuthor').html(output); }); //Go through each post }); }
However, here comes the problem... Instead of giving me a nice list just like the first screenshot, it is giving me a list like this:Code:<div data-role="content" id="listFromAuthor"> Attempting to load the blogposts of the selected author, please wait...<br><br> If this does not happen, please try reloading the page. </div> <!-- Hier komen de author posts door het script onderaan de pagina. -->
http://s16.postimage.org/oc0n6xwxh/authorlist2.png
Can anybody tell me what im doing wrong?
Thank in advance...
Zylox


Reply With Quote

Bookmarks