如何用Ajax做下拉框
<body>
<form method="post" action="getAll">
<table border="1" align="center" width="50%">
<tr>
<td colspan="2"><strong>影院查询与发布系统</strong></td>
</tr>
<tr>
<td>电影名称:</td>
<td><input type="text" name="fN"></td>
</tr>
<tr>
<td>电影类型:</td>
<td>
<select>
<option value="0">全部</option>
</select>
</td>
</tr>
<tr>
<td>主演:</td>
<td><input type="text" name="fA"></td>
</tr>
<tr>
<td>导演:</td>
<td><input type="text" name="fD"></td>
</tr>
<tr>
<td>电影名称:</td>
<td><input type="text" name="fN"></td>
</tr>
<tr>
<td>价格:</td>
<td><input type="text" name="mi">至<input type="text" name="mx"></td>
</tr>
<tr>
<td>查询:</td>
<td><input type="submit" value="提交查询内容"/></td>
</tr>
</table>
</form>
</body>
我要怎么写方法,来根据我所写的内容来查询。就是说,如果我只输个电影名称,也能查到结果,我全部输人了就能更精确的查找
另外我想电影类型是用AJax来做的求指导,给点提示,不一定要告我代码怎么写
------解决方案--------------------<%@ page language="java" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<base href="<%=basePath%>">
<title>
注册
</title>
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest() {
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if(!xmlHttp){
alert("Error Initializing XMLHttpRequest!");
}
}
function UserNameCheck() {
createXMLHttpRequest();
xmlHttp.onreadystatechange = callback;
var username = document.getElementById('username').value;
//var url = "index?user_name=" + username;
var url="user/index";
//xmlHttp.open("get", url, true);
xmlHttp.open("post",url,true);
//xmlHttp.send(null);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.send("user_name=" + username);
}
function callback() {
if (xmlHttp.readyState == 4)