Created
September 24, 2011 18:40
-
-
Save eiryu/1239681 to your computer and use it in GitHub Desktop.
jQueryで複数行fetchしたSQL結果(json形式)をhtmlに反映する
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
$("#table_result").empty(); | |
result = eval(result); | |
// ヘッダ | |
$("#table_result").append("<tr id=\"header\""); | |
for (var i in result[0]) { | |
$("#header").append("<th>" + i + "</th>"); | |
} | |
// データ | |
for (var i in result) { | |
$("#table_result").append("<tr id=\"tr" + i + "\">"); | |
for (var j in result[i]) { | |
$("#tr" + i).append("<td>" + result[i][j] + "</td>"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment