14 Replies Latest reply on Aug 31, 2017 6:51 AM by WolfShade

    ColdFusion JSON parsing failure: Expected '"' at character 2: '&'

    WolfShade Level 4

      Hello, all,

       

      I'm trying to convert a project so that the components folder is outside of the webroot.  For the most part, this has been a smooth transition.

       

      Until (dun dun dunnnnnnnn) I get to the parts where I am using AJaX to submit forms.  When the component was in the webroot, it was very simple, very straightforward.  Now that the components exist outside the webroot, cfajaxproxy is giving me fits.

       

      If all I'm submitting is a single form field value, it works.  If I'm submitting an entire form using jQuery.serializeArray(), suddenly there's a problem.

       

      postData = $('#'+formID).serializeArray();
      thisComponent = new ERC(); //Component is in F:\webdocs\_com\public\ERC.cfc and components are mapped in application.cfc
      thisComponent.setHTTPmethod('POST');
      thisComponent.setCallbackHandler(displayResult);
      thisComponent.setErrorHandler(displayFail);
      thisComponent.dtsSurvey(postData); // Submit the form to the function "dtsSurvey" in ERC.cfc
      

       

      This results in the error message mentioned in the subject:  JSON parsing failure: Expected '"' at character 2: '&'

       

      The reason why is because ColdFusion sees: {"form":[{"name"...  (The JSON " are being converted to ASCII.)

       

      How can I fix this?  I've Googled for it, and I'm not finding a solution.

       

      V/r,

       

      ^ _ ^