I would like to use the Limesurvey API with jquery. When I try to get the session-key with the following code I get the error message 631: failed to parse request, when I enable the xml rpc. And no response when json-rpc is enabled.
$.post("url_to_survey/index.php/admin/remotecontrol",{
username : "foo", password : "bar"
},
function(data) {
alert('sessionKey: ' + data);
}
);
Could anyone post an example query, please?
Try to force the dataType
parameter to your request, like this :
$.post("url_to_survey/index.php/admin/remotecontrol",
{method : 'get_session_key', username : "foo", password : "bar" },
function(data) {
alert('sessionKey: ' + data);
},
'json'
);
Use dataType: "json"
if you enable json-rpc
, etc.
Edit : just add the method name