function render_problems() { $.post("/api/problem/data", { }, function(data) { data = data["data"]; for (var i = 0; i < data.length; i++) { files = data[i]["files"]; problem = `

` + data[i]["name"] + ` | ` + data[i]["category"] + `

` + data[i]["description"] + `

` for (var j = 0; j < files.length; j++) { file_name = files[j].split("/").pop(); problem += `

` + file_name + `

` } problem += `
` + data[i]["hint"] + `
` $("#problems").append(problem); } }); } function show_hint(pid) { $("#hint_" + pid).slideToggle(120, "swing"); } $(document).ready( render_problems() );