3 Replies Latest reply on Aug 14, 2011 2:15 PM by Evik.James

    Getting throw new SyntaxError("parseJSON"); cfajax.js (line 803)

    Cal_T

      First of all, I have looked through forums and have found others with similar problems, but i have tested all their recommendations and still no success.  So i'm hoping someone can help. I'll try to provide as much information as possible.

       

      So being new to working with Ajax, im trying to make an ajax call from a .cfm to a .cfc using cfajaxproxy, which is where i keep getting this error.  My cfm is a form that produces a checklist based on the user.  As each checkbox is checked, i want a call to the cfc to run a function, make queries etc.  As of right now, when the user selects a check box the information is being passed to the javascript, but there is no response from the cfc function and i keep getting the mentioned error in firebug.

       

      -I have tried creating a copy of my cfc in the wwwroot folder and giving it blank data (cffunction named whatever, cfargument named nothing set to  "") and use the extends parameter pointing to the out-of-root CFC, but that doesnt work

      http://forums.adobe.com/message/3683967#3683967

       

      -There is nothing outputting any html comment in my cfc as mentioned in

      http://forums.adobe.com/message/2796016#2796016

       

      .cfm

      <cfajaxproxy cfc="orientation_funcs" jsclassname="orientation_funcs" />
      <html xmlns="http://www.w3.org/1999/xhtml">
          <head>   
              <link rel="stylesheet" type="text/css" href="orientation.css" />
              <title>Ryerson Orientation - Main Page</title>
             
              <script type="text/javascript">       
                      function updateEvent(eventId){
                      var instance = new orientation_funcs();
                      alert(eventId);       
                      instance.test(eventId);
                      alert("after calling the method");
                  }
              </script>

           ............

           .......

      <cfform action="orientation_login_process.cfm" method="POST">
                      <cfoutput query="scheduleOfEvents">
                          <!--- Table displaying the various orientation events available to the student --->
                          <table class="center">

                          ..............

                          ...................

                          <td style="width:5%;">
                                      <cfinput type="checkbox" id="eventSelect_#event_Id#" name="eventSelect" value="#event_id#" onclick="updateEvent(#event_id#)">
                                  </td>
                                  <!--- <cfif #completed# is 'F'>
                                      <td style="width:5%;">
                                          <cfinput type="checkbox" name="eventSelect" value="#event_id#">
                                      </td>
                                  <cfelseif #completed# is 'T'>
                                      <td style="width:5%;">
                                          <cfinput type="checkbox" name="eventSelect" value="#event_id#" checked="True" readonly="true">
                                      </td>
                                  </cfif> --->
                              </tr>
                          </table>
                      </cfoutput>  
                  <cfinput type="submit" name="Save" value="Save Progress">
                  </cfform>       
             
          </head>
          <body>

       

      .cfc (in the same folder as the .cfm)

      <cfcomponent displayname="orientation_funcs"
                   hint=""
                   output="false">

       

      <cffunction name="test" access="remote" output="false" returnFormat="JSON" hint="">
              <cfargument name="ev" type="string" required="yes">
                <script>

                     alert("inside cfc function");

                </script>

      </cffunction>


      .cfc (in the wwwroot folder)

      <cfcomponent displayname="orientation_funcs"
                   hint=""
                   extends="Orientation_App.orientation_funcs"
                   output="false">

        <cffunction name="whatever" access="remote" hint="" >
              <cfargument name="nothing" default="">
          </cffunction>  
      </cfcomponent>

       

       

      So what happens now is, when i select the checkbox on the form, the initial alert message in updateEvent(eventID) function appears, but the message inside the cfc function does not get produced.  In firebug, the "throw new SyntaxError("parseJSON"); appears.  Any help or suggestions would be greatly appreciated and thanks in advance.