使用tr和td在HTML表中显示JSON数据,而不是使用ASP.NET控件。 [英] Show JSON data in an HTML table with tr and td instead using of ASP.NET controls.
问题描述
这里我试图在表格而不是控件中显示My JSON数据。根据返回的值,它以tr和td格式显示。
这是我的JS代码...
Here I have tried to display My JSON data in a table instead of controls. as per the value returned it display them in tr and td format.
Here is my JS code...
$(document).ready(function () {
$("#btnVAaided").click(function () {
alert($('#hdnVisitId').val());
alert($('#hdnPatientId').val());
$.ajax({
type: "POST",
url: "AjaxCall/AjaxCallUser.aspx?GetExaminationPatientHistory=1",
dataType: "json",
data: {
VisitId: $('#hdnVisitId').val(),
PatientId: $('#hdnPatientId').val()
},
success: function (data) {
$("#MdVisualAcuityAided").modal('show');
$('#txtLeft1').val(data.GetExaminationPatientHistoryResult[0].Visual_Acuity_Aided_Left);
$('#txtRight1').val(data.GetExaminationPatientHistoryResult[0].Visual_Acuity_Aided_Right);
},
faliure: function () {
alert("An error occured. Please reload.");
}
});
我需要做些什么才能在桌子上显示结果
谢谢&问候
Bigyan Sahoo
我尝试过:
函数drawtable(数据){
for(var i = 0; i< data.length; i ++){
drawrow(data [i] );
}
}
函数drawrow(rowdata){
var row = $()
$(#tblExamVaAided)。append(row);
row.append($(+ row.Visual_Acuity_Aided_Left + ));
row.append($(+ row.Visual_Acuity_Aided_Right +))
}
我试过此代码并在成功部分内调用drawtable(data)方法,但它不显示输出..
What I have to done to show the result in a table
Thanks & Regards
Bigyan Sahoo
What I have tried:
function drawtable(data) {
for (var i = 0; i < data.length; i++) {
drawrow(data[i]);
}
}
function drawrow(rowdata) {
var row = $("")
$("#tblExamVaAided").append(row);
row.append($("" + row.Visual_Acuity_Aided_Left + ""));
row.append($("" + row.Visual_Acuity_Aided_Right + ""))
}
I have tried this code and call the drawtable(data) method inside the success part but it does not show the output..
推荐答案
( document )。ready( function (){
(document).ready(function () {
( #btnVAa ided)。click( function (){
alert(
("#btnVAaided").click(function () { alert(
(' #hdnVisitId')。val());
alert(
('#hdnVisitId').val()); alert(
这篇关于使用tr和td在HTML表中显示JSON数据,而不是使用ASP.NET控件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!