JavaScript搜索脚本无法在Internet Explorer中运行?

I've the following search script but it doesn't seem to be working at all in IE. It always comes back with the "Sorry, we couldn't find anyone using that search criteria..." error.

The code is as follows:

<?

$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>

The HTML form is as expected so I won't include it apart from the last submit button in case that helps:

<div class="profilebutton" onclick="search();">Search</div>
<div class="boxleft" id='searchres_results' style='display:none;'>
</div>

For Sorry, we couldn't find anyone using that search criteria... to be outputted you need to reach that line of code. That means that snresnum == '0' is true.

This is because you set:

var snresnum = $("#searchresults_number").html();

And $("#searchresults_number").html() is '0'.

Be sure the value inside the element with the id="searchresults_number" is generated correctly in ajsearch.php. It is always 0 now.