Jquery ajax传递复杂参数给WebService
参考:
http://www.cnblogs.com/kingge/archive/2011/08/04/2127642.html
http://www.cnblogs.com/micromouse/archive/2010/08/14/1799464.html
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.Serialization;namespace Entity {[DataContract]public class User{[DataMember]public string Name{get;set;}[DataMember]public int Age{get;set;}} }
WebService:using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using Entity;namespace JQuery.Handler {[WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][System.ComponentModel.ToolboxItem(false)][System.Web.Script.Services.ScriptService]public class UserService1 : System.Web.Services.WebService{[WebMethod]public string ComplexType(User hero,Listusers){return hero.Name + " has " + users.Count + " people!";}} } Html:"http://www.w3.org/1999/xhtml"> Ajax "btnWeb" type="button" value="请求WebService" />
转载于:https://www.cnblogs.com/51net/p/4579467.html
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
