11 Replies Latest reply on Dec 16, 2014 11:54 AM by EdGioja

    cfajax and jquery json - runs in browser but not scheduler


      This one has me quite confused.


      I have a baby test routine:


      <!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>Untitled Document</title>


          <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

      <cfset dataout = timeformat(now(), "mm:ss")>

      <cfquery name="testrun" datasource="#application.ccidatasource#">

          update bridge

          set testtime = <cfqueryparam cfsqltype="cf_sql_varchar" value="#dataout#">


      <script type="text/javascript">

      $.getJSON("cciBridgeServices.cfc", {

                  method: 'testThis',

                  testtext: "schd",

                  returnformat: 'json',

                  queryformat: 'column'

              }, function(d){

                  var text = "";

                  var rows = d.ROWCOUNT;








      The service is simple as well

      <cffunction name="testThis" access="remote" returntype="numeric" 
         description="Testing function used for pretty much anything" >
         <cfargument name="testtext" required="yes">
         <cflog application="yes" text="Hello auto run">
         <cfquery name="testrun" datasource="#application.ccidatasource#">
      update bridge
      set testcol = <cfqueryparam cfsqltype="cf_sql_varchar" value="#testtext#">
         <cfreturn 1>



      If I run testrun in a browser, everything is fine.

      If I create testrun as a scheduled task in the CF Administrator, or I use wget to process it, the testThis service doesn't run.

      I verified this by adding the <cflog..> command.  The mm:ss gets updated, but the text does not.it?
      I have tried adding a returnformat and an output="no" to the <cffunction>


      Can anyone explain what is happening here and how to fix it?


      Thank you in advance