let's say i have a class:
[Serializable]
public sealed class MyFoo
{
public int ID { get; set; }
public string Name { get; set; }
}
I want to pass data from my Webservice to the JQuery ajax this class to the JS and parse it like an object.
[WebMethod]
public MyFoo GetData()
{
return (new MyFoo);
}
$.ajax({
success: function(val) {
var MyFoo = val;
$('#textbox1').val(MyFoo.ID);
$('#textbox2').val(MyFoo.Name);
}
});