RETRUN object has a one student record. how to parse the data
class Object
{
public int x{get;set;}
public string y{get;set;}
public string z{get;set;}
Object Get(int a)
{
Object a={1, "xyz","abc"};
retrun a;
}
$(document).ready(function () {
$.ajax({Type: "Get",
url: 'http://localhost:30074/api/User/Get?id=7',
datatype: "json",
contentType: "Application/json",
data: {},
success: function (data) {
bind data to the T1,T2,T3 Textboxes.
}
alert(data);},
error: function (e) {
alert("fail");
}
});

Pranay RanaPosted May 6, 2015, 7:51 AM
//parse object first which is received
//as you are returning json data
var obj = JSON.parse(data);
//than do assignment usign jquery
$("#T1").val(obj.x); //assingn value to text box having id T1
$("#T2").val(obj.y); //assingn value to text box having id T2
$("#T3").val(obj.z); //assingn value to text box having id T3
veerendra kumarPosted May 6, 2015, 8:12 AM
it is very helpful to me.