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?


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 == "") {
  else if(q==""){

  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);



   }"GET", "http://d12345678/unsubmit.php?p="+p+"&q="+q, true);   

Recommended Answers

Are one of hte values in the drop down an apostrophe by any chance?

Jump to Post

All 3 Replies

Are one of hte values in the drop down an apostrophe by any chance?

no.. all same

Hi, I found out the reason. I set the size for the <table><th> too small.. and one of data the size is more than 150px..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.