解决方案 »

  1.   

    ajax访问一个页面,由那个页面返回对应设备返回的信息
      
    *****************************************************************************
    签名档: http://feiyun0112.cnblogs.com/
      

  2.   

    我是有这么做
     strdisplay: function () {                $.ajax({
                        type: "post",
                        dataType: "JSON",
                        url: "AjaxMonitor.aspx",
                        data: $("form:eq(0)").serialize() + "&v=" + Math.random(),
                        success: function (data) {
                            alert(data.display);
                            art.dialog.tips(data.display);
                            $("#txtrich").val($("#txtrich").val() + data.display);
                            //   $("#txtrich").val( $("#txtrich").val()+data.display);
                            if (data.displayFlag == "0") {
                                setTimeout(function () { funs.strdisplay(); }, 2000);
                            } else {
                                art.dialog.tips("修改结束...");
                                $("#txtrich").val($("#txtrich").val() + "修改结束...");
                            }
                        }
                    });            },
                update: function () {
                    if (funs.getIds() == "") {
                        art.dialog.tips("请选择记录进行修改!"); return false;
                    }
                    $("#txtrich").html("开始修改!\r\n");
                    funs.strdisplay();
                    funs.updateFunction(funs.getIds());
                },
                updateFunction: function (ids) {
                    $.ajax({
                        type: "post",
                        dataType: "JSON",
                        url: "WebBSCpwd.aspx",
                        data: $("form:eq(0)").serialize() + "&type=update&method=ajax&id=" + ids + "&v=" + Math.random(),
                        success: function (data) {
                            if (data.state == "1") {
                                art.dialog.tips("修改完成!");
                            } else {                            art.dialog.tips("修改失败!");
                            }
                        }
                    });
                    return false;            },
    获取设备返回的信息放在Session中
                Response.Clear();
                Response.Write(string.Format(@"{{""displayFlag"":""{0}"",""display"":""{1}""}}", Session["displayFlag"], Session["display"]));
                Response.End();
    但是前台没有显示返回值
      

  3.   


    上面有循环调用
          setTimeout(function () { funs.strdisplay(); }, 2000);
      

  4.   

    那你就调试看ajax的返回对不对
      

  5.   


    strdisplay: function () {                 $.ajax({
                         type: "post",
                         dataType: "JSON",
                         url: "AjaxMonitor.aspx",
                         data: $("form:eq(0)").serialize() + "&v=" + Math.random(),
                         success: function (data) {                         alert(data.display);
                             art.dialog.tips(data.display);
                             $("#txtrich").val($("#txtrich").val() + data.display);
                             //   $("#txtrich").val( $("#txtrich").val()+data.display);
                             if (data.displayFlag == "0") {
                                 setTimeout(function () { funs.strdisplay(); }, 2000);
                             } else {
                                 art.dialog.tips("修改结束...");
                                 $("#txtrich").val($("#txtrich").val() + "修改结束...");
                             }
                         }                 });             },上一个红色的执行了就下一个红色的了,中间的没执行,但是在全部执行结束后有能弹框执行红色中间的代码
      

  6.   

    我后来把 EnableSessionState="true" 修改为 EnableSessionState="ReadOnly"就可以了,不过不是很明白为什么,另外我的页面嵌套了母版 执行$("#txtrich").html("开始修改!\r\n");页面不显示文字,但是去掉母板,页面就能显示开始修改的文字,有人知道为什么吗