我有jquery Ajax调用:
$.ajax({
type: "POST",
url: "http://192.168.0.70:81/MobileService.asmx/FetchData",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function (msg) {
var Tabels = msg.d;
$.each(Tabels, function(index, table) {
alert(table[0]);-------> I am trying to get the row using index, it retuns nothing
var table_data='<div class="table"';
table_data +=" onclick='test()' >"+table.Name +"</div>";
$('#itemGroup').append(table_data);
});
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert('error');
alert(errorThrown);
}
});
我想找到结果的第一个值。我怎样才能做到这一点? index返回行号(即行的索引),但是如何获取第一行值?
答案 0 :(得分:0)
使用此
$.each(msg, function (index, itemData) {
var valuesof = itemData.YourValues;
});
答案 1 :(得分:0)
if(index == 0)做了一招。
if (index==0)
{
alert(table.Name);// fetch row value
}