Hi sottwell
Yes, i understand the concepts of AJAX. Maybe i did not make myself clear:
- Document is created normally. Snippet creates a form as output
- User presses submit button. Form values are sent via HttpRequest Object (AJAX)
- Now the important part: The values are sent to the exact same URL, thus, modx will "generate" the requested document once more
- Upon snipped execution i check if the snippet is called via AJAX Request and i’d like to return some custom values instead of the normal document output
This means, that i’m not reloading the document, i’d like to get a custom response from a document when called via AJAX. Actually, the MODx output should stop before any HTML content is written and return just the AJAX response instead of generating the document as usual.
Hope that clears things up?
Edit:
Hm. Echoing my output and then calling "exit();" seems to do just what i want... Don’t know if that is the preferred way to do such a thing though. I was "inspired" by the $modx->sendErrorPage(); Method which simply exits after execution.
I’ll keep you posted if my snippet works as intended. If yes, this could be a very nice way to integrate ajax requests/responses with just one snippet.