this function is in the wring layer - should in a controller or core/ajax/preview.php