我页面中有两个DIV
<div class="SubBody" style="width: 770px; margin-left: 9px;" id="ProductScheme">
<div class="SubBody1" visible="false" style="width: 770px; margin-left: 9px;" runat="server" id="BookingDemo">
其中第一个DIV中的内容是通过.ashx文件构建出来的,
$.ajax({
                url: "Ashx/GetProduct.ashx",
                type: "post",
                data:
                    {
                        pid: obj2
                    },
                dataType: "text",
                success: function (txt) {
                    $(".SubBody").html(txt);
                }
            });
第二个DIV是在页面中写的,我想通过点击页面中的一个<a>标签,并将pid设置为1000,能否在.ashx中通过判断pid的值来控制第二个DIV的显示与隐藏啊

解决方案 »

  1.   

    你可以在.ashx文件中写一个方法啊,就判断pid的值,返回show或者hide。然后在$.ajax的success里面写
    function(txt){
        if(txt=="show"){
            $("#BookingDemo").show();
        }
        else
            $("#BoolingDemo).hide();
    }
      

  2.   

    写死$.ajax({
      url: "Ashx/GetProduct.ashx",
      type: "post",
      data:
      {
      pid: 1000
      },
      dataType: "text",
      success: function (txt) {
      $(".SubBody1").html(txt);
      }
      });