前台代码:
  $("#Save").click(function() {                //                var maindata = {
                //                    ciid: $("#Text1").val(),
                //                    CIInc: $("#company").val(),
                //                    CIIncaddress: $("#address").val()
                //                };                var id = "aa";
                var obj = { ware: [{ wareid: id}] }; //创建数据传一个编号
                var oo=JSON.stringify(obj);
                //alert(obj);
                $.ajax({
                    type: 'post',
                    url: '../../WebService.asmx/CallServices',
                    data: { diclist:oo},
                    //cache: false,
                    dataType: 'json',
                    success: function(result) {
                        alert("bb");
                        alert(result);                    },
                    error: function(msg) {
                    var ss = msg.responseXML;
                    alert(msg.responseText);
                    }                });            });
WebService.asmx中的代码
[WebMethod]
    public Dictionary<string, List<Dictionary<string, object>>> CallServices(Dictionary<string, List<Dictionary<string, object>>> diclist)
    {
        Dictionary<string, List<Dictionary<string, object>>> result = new Dictionary<string, List<Dictionary<string, object>>>();//定义一个数据字典        return result;    }
这个是为什么啊?我传单个字符就可以。而且我用最底层的的异步调用是可以的 但是为什么用Jquerey中的ajax就不行呢?
麻烦高手帮忙看看!

解决方案 »

  1.   

    $(document).ready(function(){ $.ajax( 
            { 
              type: "POST", 
              url: "", 
              data:{method:"Test"},//把要调用的函数名作为参数传递到服务器就好了 
                contentType: "application/json; charset=utf-8", 
              dataType: "json", 
              error: function(){alert('出错了');}}      
            );});  [SoapDocumentMethod("http://tempuri.org/HelloWorld")]
        public void HelloWorld()
        {    }