I'm trying to parse out some data thats returned from a web service via json with the following code.
function getADData() {
var strSearch = $('#txtSearch').val()
var ajaxData = "{ 'PartNameString': '" + strSearch + "' }";
$.ajax({
type: "POST",
url: "/Services/ActiveDirectoryInterop.asmx/SearchUsers",
data: ajaxData,
contentType: "application/json; charset=utf-8",
dataType: "json",
success:populateTable
});
}
function populateTable(result) {
alert(result["d"].length);
}
Data Returned is this.
{"d":{"Columns":["UserID","Name","Email"],"Rows":[["U99999","Lees, Smith","someemail1@canfor.com"],["U99999","Lees, Mark","someemail1@canforpulp.com"],["99999","Lees, Bob","someemail1@canforpulp.com"],["U999999","Lees, John","someemail1@canforpulp.com"],["U999999","Lees, Jim","someemail1@canforpulp.com"]]}}
What the alert though jsut returns undefined. So i know I'm missing something and it probably has to do with the nesting of the JSON. Can someone point me in the right direciton for some materials or code that shows me how to possibly traverse data like what i'm recieving.