返された JSON 配列を編集したところ、コードが壊れてしまいました。基本的に、私がしたことは、それを多次元配列 (2?) に変換することだけでした。
JS
$(function() { ...
...$.ajax({
type: "POST",
url: 'updatefilters',
dataType: 'json',
data: { filters: filters, page: page },
success: function(data){
html = "<table class='board'>";
html += "<table class='board'>";
html += " <tr>";
html += " <th width='7.5%'>Author</th>";
html += " <th width='5%'><img src='../img/board/icons/category_icon.png' alt='category_icon'/></th>";
html += " <th width='5%'>Tag</th>";
html += " <th width='50%'>Subject</th>";
html += " <th width='7.5%'>Replies/Views</th>";
html += " <th width='15%'>Last Post</th>";
html += " </tr>";
for (i=0 ; i < data[threads].length ; i++)
{
html += "<tr><td>" + data[threads][i].username + "";
}
html += "</table></div>";
$('#board').html(html);
} ...
返された JSON データ:
{"0":"blurb","filter":["blurb"],"threads":[{"thread_id":"234","owner_id":"3","subject":"Blurb(?) is in Heavy Development!","body":"Please be aware that this site is still in heavy development. What you are viewing here is a prototype, not meant to be seen as a final product. if you have comments or suggestions, please send it to rickymm3@gmail.com\n\nThank You!","timestamp":"2012-05-11 08:02:28","replystamp":"2012-05-11 08:02:28","last_post_id":"3","slug":"234-blurb-is-in-heavy-development","replies_num":"0","views":"1","username":"guest"}]}
JS コードの FOR ループで、data[threads] が未定義ですか? data[threads][i] が機能しない理由はありますか?