As promised on twitter, here is the solution I chose. (using jQuery)
1. Javascript on website
<script type="text/javascript">
$("#saveIcmForm").click(function() {
var form = $("form").serializeArray();
$.ajax({
type: "POST",
url: "[[~220]]",
data: form,
dataType: "html",
success: function($data) {
var link = $data;
$('#popupinfo').css({'display' : 'inline'});
$('#popupinfo').delay(500).fadeOut();
if ($data) {window.location = link};
}
});
});
</script>
<div id="popupinfo">Saved</div>
2. Snippet in Ressource with ID 220
<?php
$output='';
//this is the processor file name
$procname=$_REQUEST['action'];
//this is what component we are referencing
$comp=$_REQUEST['component'];
//Check Authentication
$auth = $modx->user->hasSessionContext('web');
if ($auth == false) {
return $modx->sendUnauthorizedPage();
}
//get the processor file with path
$f=$modx->getOption('core_path').'components/'.$comp.'/processors/'.$procname.'.php';
if (file_exists($f)) {
//include that file so the output of the processor is assigned here
$output= include $f;
} else {
$output= 'Action not found: '.$f;
}
//convert the processor output to json format
return $modx->toJSON($output);
3. Processor
<?php
$icmTickets = $modx->getService('icmTickets','icmTickets',$modx->getOption('icm.core_path',null,$modx->getOption('core_path').'components/icm/').'model/icm/',$scriptProperties);
if (!($icmTickets instanceof ICM)) return '';
$ticketId = $icmTickets->setTicket('', $_POST);
$link = $modx->makeUrl(203, '', array('ticketId' => $ticketId)).'&function=edit';
echo $link;
The processor uses a class to write into custom database tables and returns the last database entry id. This id is used to create a URL parameter. I know it's not recommended to use "echo" and use return instead, but unfortunately: It doesn't work this way. Another thing is, that if I add the second URL parameter within the array, it creates a &ticketId=3&function=edit. I'm using FURLs on the site.
In the form, there are to fields to address the correct processor
<input type="hidden" name="action" value="web/icmtickets/[[getUrlParam? &name=`function`]]" />
<input type="hidden" name="component" value="icm" />
Thanks for your support, guys!