读书人

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

发布时间: 2012-12-14 10:33:07 作者: rapoo

如何通过.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);
}
});

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

读书人网 >asp.net

热点推荐