5 Replies Latest reply on Aug 18, 2010 4:34 AM by Dave Miller

    cfajaxproxy throw new SyntaxError("parseJSON")

    Rodrigo Alarcon

      Hey guys, this time with some troubles i can't fix.. basically i have 2 files:





          <cffunction name="FindFleet" access="remote" returnFormat="json" output="false">
            <cfargument name="cli_id" type="numeric" required="no" default="1">
            <cfquery name="qry_allVehData" datasource="#application.datasource#">
              SELECT *
              FROM tbl_vehicles
            <cfreturn qry_allVehData>




      <cfajaxproxy cfc="fleet" jsclassname="emp">
      <script type="text/javascript">
          Array.prototype.findIdx = function(value){ 
              for (var i=0; i < this.length; i++) { 
                  if (this[i] == value) { 
                      return i; 
          var FindFleet = function(){
              var e = new emp();
          var populateFleet = function(fleet){
                  var option = new Option();
                  option.text = 'Choose a vehicle';
                  option.value = '0';
                  sel_vehicle.options[0] = option;
                      var option = new Option();
                      option.text = fleet.DATA[i][fleet.COLUMNS.fixIdx('veh_desc')] + ' (' + fleet.DATA[i][fleet.COLUMNS.fixIdx('veh_pat')] + ') ';
                      option.value = fleet.DATA[i][fleet.COLUMNS.fixIdx('veh_id')];
                      sel_vehicle.options[i+1] = option;
          var myErrorHandler = function(statusCode, statusMsg){ 
              alert('Status: ' + statusCode + ', ' + statusMsg); 
      <form name="simpleAJAX" method="get"> 
        <select name="sel_vehicle"> 
            <script language="javascript"> 



      When i call myList.cfm i'm getting this new SyntaxError("parseJSON"); for cfajax.js  (line 803) in firebug 1.5.3 when i check that line i have this, my Coldfusion Server is installed in an Ubuntu 9.10 Server with Apache2 and i refer to the CFIDE folder using a symbolic link (sudo ln -s /var/www/cfide CFIDE from inside the folder where my application resides).


      Ne help on how can i fix this error?

        • 2. Re: cfajaxproxy throw new SyntaxError("parseJSON")
          Rodrigo Alarcon Level 1

          Come on.!! is this error THAT hard to fix?


          Some expert out there that can at least confirm if this is a bug or not?

          • 3. Re: cfajaxproxy throw new SyntaxError("parseJSON")
            Rodrigo Alarcon Level 1

            Just discovered what was goin on with this error and it looks like a bug so i reported it to http://cfbugs.adobe.com with the ID 82852.


            Basically u need this:




            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>Test Document</title>





            index.cfm with some code that makes use of cfajaxproxy... for example (this should happen with any cf tag that makes use of ajax, even using something like <cfselect name="veh_id" bind="cfc:fleet.getFleet()" bindonload="yes"/> can make the bug to happen.




            <cfcomponent output="false">
                 <cfset this.name = "ScheduledTasks">
                 <cfset this.sessionmanagement = "yes">
                 <cfset this.loginstorage = "session">
                 <cfset this.setcookieclient = "true">
                 <cfset this.sessiontimeout = #CreateTimeSpan(0,0,20,0)#>
                 <cfset this.applicationtimeOut = #CreateTimeSpan(0,8,0,0)#>
              <cfset this.datasource = "ScheduledTasks">

              <cffunction name="OnApplicationStart" output="false">
                <cflock scope="Application" timeout="10" type="exclusive">
                  <cfset application.datasource = "globalGPS">
                  <cfset application.title = "ScheduledTasks">
                  <cfset application.sessions = 0>
                  <cfset application.base_Path = getDirectoryFromPath(getCurrentTemplatePath())>


                   <cfswitch expression="#MID(cgi.server_software,1,(find("/",cgi.server_software) - 1))#">
                      <cfcase value="APACHE">
                           <cfset application.sourceRPT = application.base_Path & "reports/">
                           <cfset application.sourceXML = application.base_Path & "data/">
                           <cfset application.rawImgPath = application.base_Path & "images/">
                           <cfset application.sourceRPT = application.base_Path & "reports\">
                           <cfset application.sourceXML = application.base_Path & "data\">
                           <cfset application.rawImgPath = application.base_Path & "images\">


                   <cfset application.development = true>
                   <cfset application.server = cgi.server_software>
                <cfset setlocale("Spanish (Modern)")>
                <cfcontent type="text/html;charset=iso-8859-1">
                <cflog type="information"
                  text="The application #this.name# has been started.">
                <cfdirectory action="list" directory=#application.base_Path# filter="*.cfm" name="directoryFiles">


            <cffunction name="OnRequestStart">
                <cfargument name="request" required="true"/>
                  SetLocale("Spanish (Modern)");
                <cfinclude template="header.cfm">



              <cffunction name="OnRequestEnd">
                <cfinclude template="footer.cfm">


              <cffunction name="onSessionStart">
                  Session.started = now();
                <cflock timeout="5" throwontimeout="No" type="EXCLUSIVE" scope="SESSION">
                  <cfset Application.sessions = Application.sessions + 1>
                <cflog file="#This.Name#"
                  text= "Session: #Session.sessionid# started.">

              <cffunction name="onSessionEnd">
                <cfargument name="SessionScope" required="yes">
                <cflog file="#This.Name#"
                  text="Session:  #arguments.sessionScope.sessionid# ended.">
                <cflock scope="session" type="exclusive" timeout="10">
                  <cfset StructClear(Session)>

              <cffunction name="onApplicationEnd">
                <cfargument name="ApplicationScope" required="true"/>
                <cflog file="#This.Name#"
                  text="Application #Arguments.ApplicationScope.applicationname# ended">
                <cfset StructClear(Application)>


            If you run my code, you will see that new SyntaxError("parseJSON"); for cfajax.js  (line 803) will happen, and if you comment both includes i will work. I had tryed this on Linux and Windows OS with Apache2 and IIS... and guess what... SAME ERROR! , ne1 want's to confirm this and help me find a workarround?. Remove those cfinclude is not a option since i will be having to alter almost 50 templates.

            • 4. Re: cfajaxproxy throw new SyntaxError("parseJSON")
              Dave Miller

              Any word on this?


              I am getting this error trying to do an autosuggest.


              Error: parseJSON
              Source File: https://www.sacc.com/CFIDE/scripts/ajax/package/cfajax.js
              Line: 803

              • 5. Re: cfajaxproxy throw new SyntaxError("parseJSON")
                Dave Miller Level 1

                I found out the the cfinclude at the beginning of my cfc was outputting

                an html comment and that was being returned with my JSON. Ergo, parseJSON error.

                I removed the cfoutput from the file being cfincluded and voila, no more parseJSON error.


                The Net tab in the firebug debug window was really helpful once I knew what I was looking for.


                The XHR tab shows all of the information being passed in ajax including request and response.

                The response tab, having expanded the URL shows the information that you are getting back.

                1 person found this helpful