js/ajax.js: post with ajax

This commit is contained in:
Michael Foster committed 2013-09-15 14:03:27 +10:00
1 parent fd5300a49e
commit 00833eeafd
5 files changed
+119 -2

No files matched your search

+8
View File
@@ -74,6 +74,14 @@ function error($message, $priority = true, $debug_stuff = false) {
$debug_stuff = array_combine(array('SQLSTATE', 'Error code', 'Error message'), $db_error);
}
// Is there a reason to disable this?
if (isset($_POST['json_response'])) {
header('Content-Type: text/json; charset=utf-8');
die(json_encode(array(
'error' => $message
)));
}
die(Element('page.html', array(
'config' => $config,
'title' => _('Error'),