I wrote a flow application which requires an ajax call (json response) and tried to transform it to an neos plugin, but I don’t know how to remove the layout from the ajax action response. Currently my ajax response contains the layout + my json response (e.g. <html><head>...</head><body>['json', 1, 2]</body></html>). Does somebody have an idea how to remove the layout? I found an article about how to render special formats, but this didn’t work for my plugin. I tried something like this:
json = TYPO3.TypoScript:Case {
person {
# I also failed to create an appropriate condition
condition = true
type = 'My.Package:Person.Vcard'
}
}
prototype(My.Package:Person.Vcard) < prototype(TYPO3.TypoScript:Http.Message) {
# Set the Content-Type header
httpResponseHead {
headers.Content-Type = 'text/x-vcard;charset=utf-8'
}
content = My.Package:Person.Plugin {
package = 'My.Package:Person'
controller = 'myController'
action = 'ajax'
}
}
My form (which is submitted via ajax) looks like this:
The thing that i see directly is that the form and the routing configuration use the format ‘json’. Your fusion(ts2) code above uses the path ‘vcard’ which cannot work.
The above snippet is from the documentation and was just slightly modified (condition, content). Thereby I missed to change vcard to json. I updated the snippet accordingly.
What happens if you replace the content in prototype(My.Package:Person.Vcard) with an example string? That way you can distinguish between wether the plugin or neos are guilty of adding the html code.
If I use content = My.Package:Person.Plugin it seems like the parameter matching doesn’t work, because $image (or even a test string parameter) is unset in ajaxAction.
Would it help, if I publish the current state of my plugin on github?
@mficzel Thank you for your help. I could not get it to work with the fusion approach, but with the “excluding neos”-route. Your hint about namespaces, have led me to think about property mapping with custom routes and this was the key.