• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

scheduled task / javascript / xml

Explorer ,
Jun 16, 2006 Jun 16, 2006

Copy link to clipboard

Copied

OK, here's the deal.

I use a javascript to generate a key and and ID for use with an external xml feed. To consume the xml, I use CFHTTP call from within a CF template. But since the only way (or at least so I think) to pass a javascript variable to CF is via a javascript document.location.href redirect (and passing the variables via URL variables), I have the javascript in the first page redirect and send the variables to the coldfusion template that then digests the xml and does a database insert.

Of course it works great in a browser, but when I attempt to use a scheduled task to run it, the cfadmin says that it runs successfully, but there's no db insert.

I'm figuring that it's because there's no real "document" window to redirect... so how can I solve my problem?

HELP!!!

Thanks in advance,

bill
TOPICS
Advanced techniques

Views

439

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 16, 2006 Jun 16, 2006

Copy link to clipboard

Copied

You can't do a redirect in a scheduled app - it has to be self contained. I'm not even certain JS runs in a scheduled app, because of the fact it runs browser-less and server-side only, so it can't rely on tech built into a browser normally.


You can do pretty much anything in CF that JS can do, so why not generate the key and ID with CF instead, and keep it self contained?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2006 Jun 16, 2006

Copy link to clipboard

Copied

LATEST
But since the only way (or at least so I think) to pass a javascript variable to CF is via a javascript document.location.href redirect (and passing the variables via URL variables), I have the javascript in the first page redirect and send the variables to the coldfusion template that then digests the xml and does a database insert.
You should just do a server-side redirect and avoid Javascript altogether. As a rule of thumb, one should use Javascript to manipulate data or presentation at the client end.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation