Welcome, Guest
Username: Password: Remember me

TOPIC: Implement "AJAX"-call

Implement "AJAX"-call 1 year 5 months ago #95327

  • king_and1
  • king_and1's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 29
  • Karma: 0
Well , so i got the Blue and Gray template where i changed some colors and so on....

The structure still the same.

The first question in my Survey is like : "please type in your serial number"

Well, and thats exactly where i want an Ajax call. After the user finished the input, it should start checking the serial number on a external server and provide an answer if this serial is correct or not .
I´ve searched the question.pstpl(dunno how its correct..) and i´ve found the div_class="answers" and the table´s in it. But i dont know how to specifically target this first question. So i hope this is enough information so we can go on working out this problem , if not please tell me what´s missing and i´m gonna try editing it as good as possible...
The administrator has disabled public write access.

Implement "AJAX"-call 1 year 5 months ago #95334

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4206
  • Thank you received: 790
  • Karma: 360
I've moved this post to a more appropriate category. And, please don't cross post.

You would place the JavaScript for the AJAX call in the source of the question. See - manual.limesurvey.org/Workarounds:_Manip....29_in_LimeSurvey.3F

So, if you are using the jQuery get() function, the JS would look something like:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
		var qID = {QID};
 
		$('#question'+qID+' input[type="text"]').change(function(){
			$.get('http://somedomain.com/customScript.php', { serial: $('#question'+qID+' input[type="text"]').val() } );
		});
	});
</script>

Unfortunately, I can't help you with the PHP coding.
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.
Moderators: ITEd
Time to create page: 0.110 seconds
Donation Image