如何在simultenusly上对同一个ajax调用构建2个url,以便在不同的div id中设置值。我试图使用2以下不同功能empajax& studentajax功能。 请帮忙解决我的问题。要求需要设置empname和studentname(请检查handleresponse函数)
function empajax(method,nameId)
{
url='college/cat/employee.jsp'+"?nameId="+nameId;
if(method == 'POST'){
http.open(method,url,true);
http.onreadystatechange = handleResponse;
http.send(null);
}
}
function handleResponse(){
if(http.readyState == 4 && http.status == 200){
var response = http.responseText;
if(response){
$("#empname").html(response);
}
}
}
function studentajax(method,nameId)
{
url='college/cat/student.jsp'+"?nameId="+nameId;
if(method == 'POST'){
http.open(method,url,true);
http.onreadystatechange = handleStudentResponse;
http.send(null);
}
}
function handleStudentResponse(){
if(http.readyState == 4 && http.status == 200){
var response = http.responseText;
if(response){
$("#studentname").html(response);
}
}
}