¡@

Home 

2014/10/16 ¤W¤È 12:06:18

jquery Programming Glossary: pfirstname

WebMethod returning JSON but the response obj in my $.ajax() callback is only a string

http://stackoverflow.com/questions/5228648/webmethod-returning-json-but-the-response-obj-in-my-ajax-callback-is-only-a

return json.ToString .TrimEnd new char ' ' Here is the Web Method WebMethod public static string GetPersonInfo string pFirstName string pLastName var json new JsonBuilder .AddObjectType Person json.Add FirstName Psuedo pFirstName .Add LastName Tally.. string pFirstName string pLastName var json new JsonBuilder .AddObjectType Person json.Add FirstName Psuedo pFirstName .Add LastName Tally pLastName json.Add Address 5035 Macleay Rd SE .Add City Salem json.Add State Oregon .Add ZipCode 97317.. return value ASP.NET will do it for you. Try something like this WebMethod public static Person GetPersonInfo string pFirstName string pLastName Assuming you have a server side Person class. Person p new Person p.FirstName Pseudo pFirstName p.LastName..