Browse Source

Better error handling

pull/40/head
ctrlcctrlv 11 years ago
parent
commit
979e5754a5
  1. 3
      inc/display.php
  2. 5
      js/oekaki.js

3
inc/display.php

@ -74,6 +74,9 @@ function error($message, $priority = true, $debug_stuff = false) {
if ($config['debug'] && isset($db_error)) { if ($config['debug'] && isset($db_error)) {
$debug_stuff = array_combine(array('SQLSTATE', 'Error code', 'Error message'), $db_error); $debug_stuff = array_combine(array('SQLSTATE', 'Error code', 'Error message'), $db_error);
} }
// Return the bad request header, necessary for AJAX posts
http_response_code(400);
die(Element('page.html', array( die(Element('page.html', array(
'config' => $config, 'config' => $config,

5
js/oekaki.js

@ -254,10 +254,9 @@ $("form[name='post']").on("submit", function(e){
processData: false, processData: false,
contentType: false, contentType: false,
success: function(data) { success: function(data) {
//location.reload(); location.reload();
console.log(data);
}, },
error: function(data) {alert("Something went wrong!"); console.log(data)} error: function(jq, data) {alert($('h2',jq.responseText).text());}
}); });
} }

Loading…
Cancel
Save