首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

怎么通过.ashx文件控制页面中DIV的显隐

2012-12-14 
如何通过.ashx文件控制页面中DIV的显隐?我页面中有两个DIVdiv classSubBody stylewidth: 770px mar

如何通过.ashx文件控制页面中DIV的显隐?
我页面中有两个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的显示与隐藏啊

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


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

[其他解释]
学习了,不过还是不明白

热点排行