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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<cfset dataout = timeformat(now(), "mm:ss")>
<cfquery name="testrun" datasource="#application.ccidatasource#">
set testtime = <cfqueryparam cfsqltype="cf_sql_varchar" value="#dataout#">
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#">|
|set testcol = <cfqueryparam cfsqltype="cf_sql_varchar" value="#testtext#">|
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
BTW, it doesn't matter if I use a cf ajaxproxy or I use jquery.
Haxtbh is right. Funnily enough, the title of your thread is itself the answer: "cfajax and jquery json - runs in browser but not scheduler".
If that's the case, is there a product/solution?
You can use <cfinvoke> - https://wikidocs.adobe.com/wiki/display/coldfusionen/cfinvoke
Or something like CreateObject - CreateObject: component object - ColdFusion, English documentation - Adobe Learning Resources
<cfset comp = CreateObject('component','cciBridgeServices.cfc')>
<cfset result = comp.testThis('someText')>
I replied "to original discussion" I don't know if you get notified that way, so I'm just "poking" you.
Then I'm not seeing the answer. I thought the scheduler (or wget) runs a url (a web page).
I appreciate that question haxtbh. The answer may lie in a basic misunderstanding on my part that I need to be educated on (so please be kind). Keep in mind that this is a very small and targeted sample of a much larger application...the sample program is only designed to point out the problem.
All of this works fine interactively My task now is to take this interactive process, add some default inputs to the form, and run it periodically via a scheduler.
Are the inputs required for task different all the time? You can pass variables through the task URL to the server side code or store them in a database to be read when the task executes. What you are needing to do is remove all the interactive stuff and leave just your coldfusion code.
For example, you could run the interactive process as normal but instead create a task that calls your coldfusion page with all the table updates etc rather then calling this page directly. This will then be run initially for the first time and then scheduled for a future time.
The other issue I will have to address when I'm looking at my code is to ensure I don't have any SESSION variables.
My basic misunderstanding was that scheduler was server-side only. I was thinking that it emulated a browser.
I thank you for your help and patience.
Just in case someone else stumbles across this and finds it helpful...
It might also be helpful to know that you don't have SESSION variables BUT, if the CLIENT variables are stored in a database rather than cookies (an CF is set up to allow them), you do have access to THOSE.