Hi, I'm wondering what might be the best way to replace the entire response body from within a snippet.
Why?
To summarise, my snippet returns javascript content, which in turn sends xhr requests for additional content. I'm thinking it would be tidier, if the xhr requests were sent to the same page. So the one snippet would be able to both render the original javascript content, and deal with xhr requests later.
How?
I figured I could just print a json response and then die(); but that seems like a dirty hack, so I've been looking through the API trying to find a better way.
I've been stumbling through the API, but I'm a novice, and I don't seem to be able to find the info I need. Thus far I've found the $modx->response object, and I can see that it contains things like $modx->response->body etc, but writing directly to that property from within the snippet has no effect, I assume because that property is over written later on.
So I guess I'm looking for a way for the snippet to set $modx->response->body and then cancer further processing and just send the response.
Is this possible? is there a better way?
Thanks in advance.