大家帮我看一下,大致没问题就是有bug。我都急死了,关于jquery.get
贴全代码太长了,我讲一下,贴一部分代码出来。
是一个房产网站。就是根据条件筛选出适合条件的房源。
其他功能都没有问题。点击那写区域。或者是价格。都可以正常显示。房源跟分页都显示。就是不能按照搜索框里的条件搜索。一搜索条数是出来了但是房源没有出来。
愿意帮我的 我留个qq号。385765907
[img=http://hi.csdn.net/attachment/201110/21/7310960_1319195357fuQk.jpg][/img]
页面部分代码
[code=C#]
<body onload= "jugeButtom=0;GetSearchByWhere(1) ">
<form id= "form1 " runat= "server ">
<div style= "width:100%; margin-left:20px; margin-right:20px; ">
<searTop:top ID= "Top1 " runat= "server " />
<div style= "margin-left:auto; margin-right:auto; width:960px; ">
<div style= " "> 您的位置:首页 > 搜索房源 > 写字楼 </div>
<div style= "width:100%; ">
<div id= "s2 " class= "grid_8 " style= "height:27px; line-height:35px; width:100%; " >
<table width= "500 " cellspacing= "0 " cellpadding= "0 ">
<!-- 搜索上面--> <tr>
<td>
<label> 搜索:
<input type= "text " name= "keyword " id= "keyword " value= "请输入房源名称、地域 " onfocus= 'if(this.value== "请输入房源名称、地域 ")this.value= " "; ' onblur= 'if(this.value== " ")this.value= "请输入房源名称、地域 "; ' style= "line-height:29px; " />
</label>
<label>
<input type= "button " name= "put-in " id= "put-in " value= " " style= "cursor:pointer; " onclick= "GetSearchByWhere(1);jugeButtom=0; " />
</label>
</td>
</tr>
<!--关键字提示--> <tr>
<td style= "padding-left:43px; ">
<div id= "DownList " style= "display:none; ">
<table width= "100% " cellpadding= "2 "> </table>
</div>
</td>
</tr>
</table>
</div>
</div>
<br />
<br />
<div id= "SaleType " style= "margin-top:5px;width:100%;font-weight:bold;font-size:14px; "> 类型:
<a id= "xzChu " style= "color:Blue; font-weight:bold; font-size:14px; " href= "javascript:; " onclick= 'GetSaleType( "0 ");jQuery( "#chuzu ").attr( "style ", "display:block; ");jQuery( "#chushou ").css( "display ", "none "); jQuery( "#xzChu ").css( "font-weight ", "bold "); jQuery( "#xzShou ").css( "font-weight ", "bold "); this.style.color= "#ee0805 ";jQuery( "#xzShou ").css( "color ", "Blue ") '> 写字楼出租 </a>
<a id= "xzShou " style= "color:Blue; font-weight:bold; font-size:14px; " href= "javascript:; " onclick= 'GetSaleType( "1 ");jQuery( "#chuzu ").css( "display ", "none ");jQuery( "#chushou ").css( "display ", "block "); jQuery( "#xzShou ").css( "font-weight ", "bold "); jQuery( "#xzChu ").css( "font-weight ", "bold "); this.style.color= "#ee0805 ";jQuery( "#xzChu ").css( "color ", "Blue ") '> 写字楼出售 </a>
</div>
[/code]
javascript 代码
[code=JScript]
var Area = " "; //区域
var Square = " "; //面积
var Price = " "; //单价
*********等等一些其他条件
var HouseType = " "; //房型
var Map_Where_Search = " "; //从map传过来的where 条件
var SaleMoney= " ";
var keyword= " ";
function GetSearchDecorate(D_ecorate)//装修程度
{
Decorate=D_ecorate ;
if(Decorate!= " ")
{
$( "#Decorate> a ").css( "color ", "Blue ");
}
GetSearchByWhere(1);
}
function GetHouseStyle(H_houseStyle)//房型
{
HProperty=H_houseStyle;
if(HProperty!= " ")
{
$( "#huxing> a ").css( "color ", "Blue ");
}
GetSearchByWhere(1);
}
function GetSearchByWhere(Page_Index)//根据页数来获取房源。。。。
{
keyword = jQuery( "#keyword ").val();
if (keyword == "请输入房源名称、地域 ")
{
keyword = " ";
}
$.get( "Office.aspx?Search=dd&SaleType= "+escape(SaleType)+ "&Area= "+escape(Area)+ "&Square= "+escape(Square)+ "&Price= "+escape(Price)+ "&SalePrice= "+escape(SalePrice)+ "&SaleMoney= "+escape(SaleMoney)+ "&keyword= "+escape(keyword)+ "&pageindex= "+escape(Page_Index)+ "&HTime= "+escape(HTime)+ "&paixu= "+paixu+ "&huxing= "+HProperty+ "&Decorate= "+Decorate,
function(Result){
if(Result== " ")
{
$( "#House_Content ").html( "对不起,没有找到您搜索的房源。 ");
jQuery( "#House_Content_Top_Left ").html( " ");
jQuery( "#House_Content_Top_Right ").html( " ");
jQuery( "#House_Content_Buttom ").html( " ");
return ;
}
var json=eval(Result);
var html= " ";
for(var i=0;i <json.length;i++)
{
////这里是接受到后台返回来的json 我对javascript不是很明白,但是我知道这里是接受的是返回的对象。
////然后把这些对象添加到页面里。
}
$( "#House_Content ").html(html);
}
);
GetHouseCount(Page_Index);//获取根据条件搜索出来的总条数。
}
////////////////////////////////////显示分页的。///////////////////////////////////////////////////////////
//分页
var PageNum = 0; //总页数
var PageIndex = 1; //第几页
var PageCount = 0; //总条数
var jugeButtom = 0; //判断是否再次加载House_Content_Buttom内容
function GetHouseCount(Page_Index)//获取房源的内容分页的
{
keyword = jQuery( "#keyword ").val();
if (keyword == "请输入房源名称、地域 ") keyword = " ";
$.get( "Office.aspx?SearchCount=dd&SaleType= "+escape(SaleType)+ "&Area= "+escape(Area)+ "&Square= "+escape(Square)+ "&Price= "+escape(Price)+ "&SalePrice= "+escape(SalePrice)+ "&SaleMoney= "+escape(SaleMoney)+ "&keyword= "+escape(keyword)+ "&HTime= "+escape(HTime)+ "&huxing= "+HProperty+ "&Decorate= "+Decorate,
function(Result){
if(Result==0)//返回的条数为0
{
jQuery( "#House_Content_Top_Left ").html( " ");
jQuery( "#House_Content_Top_Right ").html( " ");
jQuery( "#House_Content_Buttom ").html( " ");
return ;
}
///////返回分页的信息。////////////////
jQuery( "#House_Content_Buttom ").html(html);
});
}
//////////////////////////////////////显示分页结束//////////////////////////////////////////////////////
[/code]
Office.cs里代码
[code=C#]
public partial class Office : System.Web.UI.Page
{
public List <Area> list = null;
public string Arealiststr = null;//显示区域的字符串
protected void Page_Load(object sender, EventArgs e)
{
ShowArea();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
if (Request.QueryString[ "Search "] != null)//就是这个地方,一旦搜索框里填了数字,点击搜索这里都不走
{//但是下面的条数走的,问题我很奇怪的是,我点击了搜索就进了GetSearchByWhere()方法,就应该走这一步啊,为什么呢???太长了,谢谢你们。
Dictionary <string, string> dic = GetSearchPar();//获取了查询参数
int i = int.Parse(Request.QueryString[ "pageindex "]);
List <House1> H_ouseList = BaiLian.BLL.HouseManager.GetHouseBySearch(dic, i, 6, "写字楼 ");
if (H_ouseList.Count == 0)
{
Response.Write( " ");
Response.End();
return;
}
string json = Newtonsoft.Json.JsonConvert.SerializeObject(H_ouseList);
Response.Write(json);
Response.End();
}
if (Request.QueryString[ "SearchCount "] != null)//判断是否没有房源
{
Dictionary <string, string> dic = GetSearchPar();//获取了查询参数
int HouselistCount = BaiLian.BLL.HouseManager.GetSreachHouseCount(dic, "写字楼 ");
if (HouselistCount != 0)
{
Response.Write(HouselistCount);
Response.End();
}
else
{
Response.Write(HouselistCount);
Response.End();
}
}
}
private Dictionary <string, string> GetSearchPar()//获取搜索参数
{
Dictionary <string, string> dic = new Dictionary <string, string> ();
string SaleType = Request.QueryString[ "SaleType "];//租售
if (SaleType == null)
dic.Add( "SaleType ", " ");
else
dic.Add( "SaleType ", SaleType);
///////////////////////////省区一些参数的判断//////////////////////////////////////
string Decorate = Request.QueryString[ "Decorate "];
if (Decorate == null || Decorate == " " || Decorate == "不限 ")
dic.Add( "Decorate ", " ");
else
dic.Add( "Decorate ", " ");
return dic;
}
protected void ShowArea()//绑定区域的字符串
{
///字数有限制
}
}
[/code]
[解决办法]
说明Reqest.QueryString["Search"]为null 你检查下参数
[解决办法]
if (Request.QueryString["Search"] != null)