java script error Expected ')'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • areamike
    New Member
    • Mar 2010
    • 2

    java script error Expected ')'

    One of our programmers is having an issue with a Javascript error and asked me to research it for him. Here's the code:

    Code:
    function dataRequest(action,dataValue,eID) {
      if (ajaxRequest.readyState!=0) return;
      if(dataValue=="") return;
      if(dataValue=='') dataValue='0';
      url = "https://207.42.229.4/cgi-bin/D3CGIServer/processAjax/~/" + action + "/" + dataValue + "/" + eID;
      ajaxRequest.open("POST", url, true);
      ajaxRequest.onreadystatechange = updateCS;
      ajaxRequest.send(null);
    }
    function updateCS() {
      if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200) {
        var resp = eval( '(' + ajaxRequest.responseText + ')' );
        if(resp.errors!=""){
           alert(resp.errors)
        }
        if(resp.response!=""){
           eID=resp.element
           if(eID!=""){
              okayToSelect=resp.focus
              document.getElementById(eID).value=resp.response;
              if(okayToSelect=='YES'){
                 document.getElementById(eID).select();
              }
           }
        }
        ajaxRequest=CreateRequest();
      }
    }
    The error occurs at line 12
    var resp = eval( '(' + ajaxRequest.res ponseText + ')' );
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    what is ajaxRequest.res ponseText?

    Comment

    • areamike
      New Member
      • Mar 2010
      • 2

      #3
      That's what his program on the server side returns.
      I think we may have found the issue. I did some research on how to handle ajax responses and instead of:
      '(' + ajaxRequest.res ponseText + ')'
      I think it should be
      ("+ajax.request .responseText+" )

      He's going to try that. Hopefully it's that simple.

      Oh and he said that ajaxRequest.res ponseText is what his program on the server side returns. It returns the response in "Jason" format. Then resp.element is dob1.

      I'm no programmer and am just conveying what he has told me. All greek to me to be honest. Don't shoot the messenger. :-)

      Comment

      Working...