如何在服务器端 把对象(DataSet, struct..)生成 符合 客户端 ajax(jquery)xml格式 的 文档。
当前DataSet是返回客户端用这种方式实现的:
[WebMethod(true)]
[System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml)]
public DataSet area_getAreaBJ()
{
....
}
对 struct 是这样返回客端的:
[WebMethod(true)]
public PostRecord user_GetPostRecord( string strParam)
{
...
}
现在在服务器端直接生成 xml的格式,统一返回如下的结构体:
struct AjaxResponse
{
public string strRst;
public string strJS;
public string strCont;
};
strCont 为 xml或json 结构的数据。