jquery ajax

 

    $.ajax({

            type: "post",

            url: "PersonalPortalService.ashx?Method=PersonalWidget_Add",

            async: false, //同步的ajax 并未异步

            data: { row: row, column: column},

            dataType: 'json',

            beforeSend: function (XMLHttpRequest) {



            },

            success: function (data, textStatus) {

                //var result = eval('(' + result + ')');

                

            },

            complete: function (XMLHttpRequest, textStatus) {

                //HideLoading();

            },

            error: function () {

                //请求出错处理

            }

        });

 

 JQuery的Ajax跨域请求的解决方案

 http://www.open-open.com/lib/view/open1334026513327.html

JQuery AJAX提交中文乱码的解决方案

http://www.mhzg.net/a/20113/2011398400802.html

jQuery的ajax 方法提交多个对象数组问题 C# traditional $.param

var arr1=[{ "aa": "1", "bb": "2" }, { "aa": "3", "bb": "4"}];



var arr2=[{ "aa": "1", "bb": "2" }, { "aa": "3", "bb": "4"}];





function addUser(){



        $.ajax({

            url:'UserAdd',

            data:$.param(arr1.serializeObject("list1"))+"&"+$.param(arr2.serializeObject("list2"),    //手动把数据转换拼接

            type:'post',

            traditional:true,    //这里必须设置

            success:function(msg){

                if(msg=='1'){

                    console.log('添加成功');

                }else{

                    console.log('添加失败')

                }

            }

        });

    }

 

 后台接收:

public class Test

    {

        public int aa{ get; set; }

        public int bb{ get; set; }

    }



        public ActionResult UserAdd( List<Test> list1, List<Test> list2)

        {

            

            return Json(amm);

        }

 

 

你可能感兴趣的:(jQuery ajax)