Welcome, Guest
Username: Password: Remember me

TOPIC: Run cron at the end of survey

Run cron at the end of survey 2 years 11 months ago #67678

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
Is it possible to somehow run a cron (url) when someone have submitted a survey? An admin notification is always sent, so I was thinking it should be possible to fire a cron also?
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
The administrator has disabled public write access.

Re: Run cron at the end of survey 2 years 11 months ago #67703

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4195
  • Thank you received: 789
  • Karma: 359
You can automatically load the end URL but that will redirect the respondent.

Alternatively you can use JavaScript in the end page to fire a remote script.

Check out this post - www.limesurvey.org/en/forum/can-i-do-thi...on-of-a-survey#55975.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

[SOLVED] Re: Run cron at the end of survey 2 years 11 months ago #67744

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
Yepp, this one worked like a charm. I put it with the end message:
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		$.get('cronfile.php');
 
	});
</script>
Great, thanks :)
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
Last Edit: 2 years 11 months ago by waitz.
The administrator has disabled public write access.

Re: Run cron at the end of survey 2 years 10 months ago #67784

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
Oops, I need to add a parameter behind the php file (&sid...), and then the get-function doesn't seem to work.

I tried to google for a javascript that can fire off the cron url, so that I can call the php file with the parameter behind, so I tried to change the script above to $.url instead of $.get, but I can't make it work...

Anyone has an idea that might work?
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
The administrator has disabled public write access.

Re: Run cron at the end of survey 2 years 10 months ago #67785

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
Hmm, I replaced the line above from:
$.get('cronfile.php');
to:
jQuery.ajax({url:"my.url.with.parameter", async:false})
And it seems to work. I don't know that much script, so can I presume it is a success? :)
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
Last Edit: 2 years 10 months ago by waitz.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.258 seconds
Donation Image