这是我的 html 文件,它调用提交按钮的处理函数 onclick。我的问题是,当我调用作为 javascript 函数的 process 函数时,它会刷新漏洞页面,并且 ajax 没有返回任何内容,#loadscreen 也没有显示任何内容
<head><script src="jquery-1.9.1.min.js"></script></head>
<form name="myForm">
Category
<select name="category">
<option>..........</option>
<option>.........</option>
<option>.......</option>
<option>......</option>
</select>
<br/><br/>
Experience <br/>
<select name="experience">
<option>......</option>
<option>......</option>
<option>......</option>
<option>......</option>
<option>......</option>
</select>
<br/><br/>
Location
<select name="location">
<option>......</option>
<option>......</option>
<option>......</option>
<option>.......</option>
<option>........</option>
</select>
<input type="submit" name="submit" value="Search" onclick="Process(); return false;"> </input>
</form>
<div id="container" style="z-index: 1; width: 830px; height: 356px; position: absolute; top: 194px; left: 218px"></div>
<div id="loadScreen" style="display: none;width: 100%; height: 100%; top: 0pt;left: 0pt;">
<div id="loadScr" style="filter: alpha(opacity = 65); z-index: 9999;border: medium none; margin: 0pt; padding: 0pt; width: 100%; height: 100%; top: 0pt;left: 0pt; background-color: rgb(0, 0, 0); opacity: 0.2; cursor: wait; position: fixed;"></div>
<div id="loader" style="z-index: 10000; position: fixed; padding: 0px; margin: 0px;width: 30%; top: 40%; left: 35%; text-align: center;cursor: wait; ">
<img src="busy.gif" alt="loading" />
</div>
</div>
这是使用 ajax 的 Process 函数的代码和繁忙页面的代码
function Process( )
{
$('#loadScreen').show(function() {
var exp = document.forms['myForm']['experience'].value;
var loc = document.forms['myForm']['location'].value;
var cat = document.forms['myForm']['category'].value;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("container").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","filter.php?experience="+ exp +"&location=" + loc + "&category=" + cat, true);
xmlhttp.send();
});
}