Dear all,
May I know what is the problem for my source code.
I let the user to choose the Quarter and Subdept. But when the user choose one of the Subdept, it will show this error
Expected '}' at line (var rows = eval('(' + xmlhttp.responseText + ')');)
May I know why?
Thanks
function doQuery() {
var idx = getField("Quarter").selectedIndex;
var selectedValue = getField("Quarter").options[idx].value;
var selectedLabel = getField("Quarter").options[idx].text;
var adx=getField("subdept").selectedIndex;
var selectedValue1=getField("subdept").options[adx].value;
var selectedLabel1=getField("subdept").options[adx].value;
var p = selectedValue;
var q = selectedValue1;
if (p == "") {
//clearGrid();
return;
}
else if(q==""){
return;
}
if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else{ // code for IE5, IE6
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var rows = eval('(' + xmlhttp.responseText + ')');
for (var i = 0; i < rows.length; i++)
{
var table=document.getElementById("unsubmitTable");
var row=table.insertRow(1);
var cell1=row.insertCell(0);
var cell2=row.insertCell(1);
var cell3=row.insertCell(2);
cell1.style.fontSize="12px";
cell2.style.fontSize="12px";
cell3.style.fontSize="12px";
cell1.style.color="black";
cell2.style.color="black";
cell3.style.color="black";
cell1.innerHTML=rows[i].DRIVERNAME;
cell2.innerHTML=rows[i].EMAIL;
cell3.innerHTML=rows[i].DEPARTMENT;
}
}
}
xmlhttp.open("GET", "http://d12345678/unsubmit.php?p="+p+"&q="+q, true);
xmlhttp.send();
}
getField("Quarter").onchange=doQuery;
getField("subdept").onchange=doQuery;