var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function queryUserInfo() {
var jrntl_id = document.getElementById("jrntl_id").value;
if(jrntl_id == "") {
return;
}
var url = "../jsp/gywork/getInfo.jsp?userId="+jrntl_id;
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleAddStateChange;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}
function handleAddStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
var responseXML = xmlHttp.responseXML;
var queryResult = responseXML.getElementsByTagName("queryResult")[0].firstChild.nodeValue;
if("failed"== queryResult){
document.all("jyId").innerHTML="請輸入正確號";
}else{
var name = responseXML.getElementsByTagName("name")[0].firstChild.nodeValue;
var bank_id = responseXML.getElementsByTagName("bank_id")[0].firstChild.nodeValue;
var bank_name = responseXML.getElementsByTagName("bank_name")[0].firstChild.nodeValue;
document.getElementById("jrntl_id_name").value = name;
document.getElementById("jrnbr").value = bank_id;
document.getElementById("jrnbr_name").value = bank_name;
document.all("jyId").innerHTML="號正確";
}
}
else {
alert("進行後台資料擷取發生錯誤!");
}
}
}