【发布时间】:2015-09-09 08:01:00
【问题描述】:
我使用选项值构建搜索查询。我通过 json 代码获取国家、州、城市。我通过 json 代码获取 onload 的国家/地区列表。但是当我更改国家/地区的值时,顶部内容也会在获得结果之前显示分页。加载 img 在分页中可以正常工作,但在选项值中却不行。
这是选择选项图片的第一个链接:-https://www.dropbox.com/s/jvie2x82l2vx4kp/search1.png?dl=0
第二个链接是搜索图片:-https://www.dropbox.com/s/1pe5r5uy9wi19m8/search2.png?dl=0
session_start();
if(isset($_GET['search']))
{
$q=$_GET['profession'];
$_SESSION['name']=$_GET['profession'];
}
else
{
session_unset();
}
if(isset($_GET['country']))
{
$_SESSION['country']=$_GET['country'];
}
if(isset($_GET['state']))
{
$_SESSION['state']=$_GET['state'];
}
if(isset($_GET['region']))
{
$_SESSION['region']=$_GET['region'];
}
enter code here
<script>
$(document).ready(function(){
$("#country").bind("change", function() {
$.ajax({
type: "GET",
data: "country="+$("#country").val(),
cache: false,
beforeSend: function(){ $("#ajaxLoader").show(); },
complete: function(){ $("#ajaxLoader").hide(); },
success: function(html) {
$("#pagination").html(html).show();
}
});
});
});
</script>
<div id="mhead"><h2>Search Result</h2></div>
<div class="content">
<body onload="listOfCountries('country');">
<form>
<p>Country:
<select name="country" id="country" onchange="listOfStatesOrCities(this,'state');" style="width:150px;"> */
<option value=""></option>
</select>
State:
<select name="state" id="state" onchange="listOfStatesOrCities(this,'region');" style="width:150px;">
<option value=""></option>
</select>
city:
<select name="region" id="region" style="width:150px;" >
<option value=""></option>
</select>
</p>
</form>
<div id="ajaxLoader" style="display:none"><img src="images/loading.gif" alt="loading..."></div>
<div id="loading" style="display:none"><img src="images/loading.gif" alt="loading..."></div>
<div id="pagination" cellspacing="0">
</div>
</div>
【问题讨论】: