Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Ajax post data not working

More
5 years 5 months ago - 5 years 5 months ago #195566 by wilson31begijnendijk
Hi,

Is there any reason why this short test script should not work ?

It works fine if I skip the line [data:{test:"yeseys"},] but ofcourse I would like to post some data from the previous questions.

$.ajax({
method:'post',
url:'/AdminLTE/Limesurvey/test.php',
dataType: 'json',
data:{test:"yeseys"},
success:function(d) {
alert (d.doh);
}
});

Thanks for any input.
Frans
Last edit: 5 years 5 months ago by wilson31begijnendijk.
The topic has been locked.
More
5 years 5 months ago #195585 by DenisChenu
Expression system check for {something}

Then to disable Expression add space (or new line

data:{
test:"yeseys"
},

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
5 years 5 months ago #195597 by Joffm
Replied by Joffm on topic Ajax post data not working
Hi, Frans,

I usually use this (without json):
Code:
$(document).on('ready pjax:scriptcomplete',function(){
 
  $.post('https://www.myServer.de/myFolder/getResult.php' , 
        {sid: "{SID}", age: "{Q1}",  gender: "{Q2}" } ,function(data) {
 
                   $('#question{QID} input[type="text"]').val(data);    //returned value
 
      });
//  $('#question{QID}').hide();
});

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
5 years 5 months ago #195598 by wilson31begijnendijk
Thank you !!!
Forgot the fact that curved brackets were used for reserved variables.

Got it to work now.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose