Skip to main content
Participant
October 3, 2015
Answered

Coldfusion Scheduled Task for HTML files with javascript ajax call to web service

  • October 3, 2015
  • 2 replies
  • 951 views

I have a plain html file, content of which are dynamically generated (on accessing it) over a few seconds (about 7-10 second) like some tables, rows of which are added through javascript after doing some processing and this process takes about said 7-10 seconds.

Using settimeout(), after 15 seconds (to ensure that content has been populated correctly), I am running a web service (.cfc with function having cfmail tag in it) through javascript ajax call which captures all html content of page and sends to marked email ids – which in normal course works fine – when page is accessed in web browser and left open for desired time of about 15-20 seconds.

However, the same page when I schedule in CF admin (even with timeout of 60 second), it never fires the sending email part.

Can I have some advise, where I am doing wrong!

    This topic has been closed for replies.
    Correct answer bikash_npcil

    Hi, finally the scheduled activity could be accomplished using native heavyweight cf codes instead of lightweight and fast javascript codes. Not a big deal anyway.

    2 replies

    bikash_npcilAuthorCorrect answer
    Participant
    October 8, 2015

    Hi, finally the scheduled activity could be accomplished using native heavyweight cf codes instead of lightweight and fast javascript codes. Not a big deal anyway.

    Legend
    October 5, 2015

    Hmm, the CF scheduler calls CF templates and does not run client-side code like a normal web browser would, as far as I am aware. You need to do the same thing with CF code only, and not using JavaScript. You can use CFHTTP to grab content from other URLs. If you could make your script work in CF only, it would then work in both cases.

    Participant
    October 8, 2015

    Thanks tribule. It worked as described !

    Legend
    October 10, 2015

    Yes, that what I said. I like it how you award the correct answer to yourself lol.