我有以下搜索脚本,但它似乎在 IE 中根本不起作用。它总是返回“抱歉,我们找不到使用该搜索条件的任何人......”错误。
代码如下:
<?
$getmystatus = mysql_query("SELECT status FROM members WHERE ID = '$session_memberid'");
while($getmys = mysql_fetch_array($getmystatus))
{
$mystatus = $getmys['status'];
}
?>
<script language=javascript>
function search() {
var snum = 0;
var name = $("#search_name").val();
var city = $("#search_city").val();
var country = $("#search_country").val();
var jobtitle = $("#search_jobtitle").val();
var company = $("#search_company").val();
var minage = $("#search_minage").val();
var maxage = $("#search_maxage").val();
var industry = $("#search_industry").val();
var male = $('#search_male').is(':checked');
var female = $('#search_female').is(':checked');
var token = $("#mtoken").val();
if(!city) { city = ''; } else {}
if(!country) { country = ''; } else {}
if(!jobtitle) { jobtitle = ''; } else {}
if(!company) { company = ''; } else {}
if(!minage) { minage = '0'; } else {}
if(!maxage) { maxage = '0'; } else {}
if(!industry) { industry = ''; } else {}
if ( name != '' ) { snum = snum+1; }
if ( city != '' ) { snum = snum+1; }
if ( country != '' ) { snum = snum+1; }
if ( jobtitle != '' ) { snum = snum+1; }
if ( company != '' ) { snum = snum+1; }
if ( minage != '0' ) { snum = snum+1; }
if ( maxage != '0' ) { snum = snum+1; }
if ( industry != '' ) { snum = snum+1; }
if ( male == true ) { snum = snum+1; }
if ( female == true ) { snum = snum+1; }
if ( snum < 1 ) {
$('#sverif').html('<font color=red>Select al least 1 type</font>');
} else {
$('#searchres_nresults').hide().html("<table border='0'><tr><td><img width=60 src='/images/loading.gif'></td><td>Searching ..</td></tr></table> ").fadeIn();
$('#sverif').html('');
var dataString = "token="+token+"&name="+name+"&city="+city+"&country="+country+"&jobtitle="+jobtitle+"&company="+company+"&minage="+minage+"&maxage="+maxage+"&industry="+industry+"&male="+male+"&female="+female;
$.ajax({
type: "POST",
url: "ajax/ajsearch.php",
async: true,
data: dataString,
success: function(data) {
$("#searchres_results").html(data);
$("#searchres_results").css("display","block");
var snresnum = $("#searchresults_number").html();
if ( snresnum == '0' ) {
$("#searchres_nresults").delay(3000).html("<div class=t23>Sorry, we couldn't find anyone using that search criteria...</div>");
} else {
$("#searchres_nresults").delay(3000).html("<div class=t23>Great news, we've found "+snresnum+" people...</div>");
}
}
});
}
</script>
HTML 表单符合预期,因此我不会将它与最后一个提交按钮分开,以防万一:
<div class="profilebutton" onclick="search();">Search</div>
<div class="boxleft" id='searchres_results' style='display:none;'>
</div>