Hello Everyone,
I’m Robby and one of the newbies to Neos and this community. If this Post isn’t in the right place, please let me know where to put similar question in the future. Thanks in advance.
I’m working on neos 2.1.3 and have to develop my own package. This package needs some basic ajax calls and I can’t get my head around. Maybe some can help me with either a cool tutorial or some infos about my code.
I see that I need some changes in the routes.yaml
-
name: 'packagename'
uriPattern: 'GD-{action}'
defaults:
'@package': 'package.name'
'@controller': 'Standard'
'@action': 'getAjaxData'
'@format': 'json'
on my StandardController I’ve added a public function
public function getAjaxDataAction($action){
/*do some stuff*/
$data=array("ok","worked","fine");
return json_encode($data);
}
my javascript:
var ajaxUrl = 'GD-';
$(function() {
$.ajax({
data: '&lookup=test',
type: 'POST',
url: ajaxUrl,
dataType: "json",
success: function(data) {
console.log(data);
console.log("kam was zurück");
},
});
});
I’m getting an Error back from my Ajax Call which I couldn’t understand:
Exception while property mapping for target
type “mixed”, at property path “”: Could not find a suitable type
converter for “mixed” because no such the class/interface “mixed” does
not exist.
Can anyone help me? I just need a Function which can return me json-data!
Thanks a lot for your time
Robby