jquery ajax 提交数组值 获取是空值

function D() {
                var cks = document.getElementsByTagName("input");

                var a = new Array();
                for (var i = 0; i < cks.length; i++) {
                    if (cks[i].type == "checkbox" && cks[i].checked) {
                        a.unshift(cks[i].title);
                    }
                }
               $.ajax({
                    type: "get",
                    dataType: "text",
                    url: "../controller/Delete_message.ashx",
                    data: {"MeeageId":a},
                    beforeSend: function() { $("#HeadDiv").text("Send...").show("slow") },
                    complete: function() { $("#HeadDiv").text("Send end...").hide("slow"); },
                    success: function(msg) {
                        alert(msg);
                    }
                })
   
    }

后台代码:

       context.Response.Write( context.Request.Params["MessageId"])

  这样获取是空值  怎么办哦?


慕田峪4524236
浏览 564回答 2
2回答

qq_遁去的一_1

首先你要确定a在传过去的时候是有值的传值方式如下:data:{"MessageId":a.join(",")}另:你用的是Get请求 &nbsp; 取值时直接即可Request.QueryString["MessageId"]

牛魔王的故事

data:{MessageId:a.toString()}
打开App,查看更多内容
随时随地看视频慕课网APP