我正在从作为表格的 webmethod 中重新提取一个字符串。$.ajax 上的成功方法被命中,但不将返回的结果插入到指定元素中。
success: function(result){
$('#divSubjectQuestions').html(result);
},
当我插入一些 html 字符串时,它会被渲染,但这段代码不起作用。
编辑:
int SubjectId = Convert.ToInt32(sSubjectId);
DataTable QuestionsTable = QuestionDataAccess.RetrieveSubjectQuestion(SubjectId);
string head = "<table class='gridstyle' cellspacing='0' rules='all' border='1' style='border-collapse:collapse;width: 100%;'><tr class='headerclass'><th scope='col'>Subject l Questions</th></tr>";
string body = "";
foreach (DataRow row in QuestionsTable.Rows)
{
body += " <tr><td> <a href='QuestionDisplay.aspx?Id=" + row.ItemArray.GetValue(1) + "'style='font-size:Small;text-decoration:none;'>" + row.ItemArray.GetValue(0) + "</a><br /><span style='font-size:XX-Small;'>" + row.ItemArray.GetValue(2) + "</span> <span style='color:Gray;font-size:XX-Small;'>Boosts" + row.ItemArray.GetValue(5) + "</span> <span style='font-size:XX-Small;'>" + row.ItemArray.GetValue(4) + "</span> <span style='font-size:XX-Small;'>" + row.ItemArray.GetValue(3) + "</span> <span style='font-size:XX-Small;'>" + row.ItemArray.GetValue(6) + "</span></td></tr>";
}
// return head + body + "</table>";
return "<p>boom!</b>";