First draft for aliquote reduction

This commit is contained in:
Andreas Moik
2016-03-03 17:00:32 +01:00
parent 2c2ad752a7
commit 5501cdbecd
11 changed files with 2055 additions and 1529 deletions
+19 -15
View File
@@ -21,7 +21,7 @@
require_once(dirname(__FILE__)."/jquery.php");
echo '
<script>
var TARGET = "";
var SERVICE_TARGET = "";
function _GET()
{
var url = window.location.href;
@@ -37,16 +37,16 @@ echo '
return vars;
}
function AJAXCall(info, successfunction)
function AJAXCall(action, successfunction)
{
if(TARGET == "")
if(SERVICE_TARGET == "")
die("Es wurde kein AJAX-Target angegeben");
$.ajax(
{
url: TARGET,
url: SERVICE_TARGET,
type: "POST",
dataType: "html",
data: info,
data: action,
timeout: 5000
}).done(function(result)
@@ -60,17 +60,20 @@ echo '
die(result);
return false;
}
if(res.erfolg)
if(res.return)
{
try
if(res.action != "")
{
var ret = JSON.parse(res.info);
successfunction(ret);
}
catch(e)
{
die(res.info);
try
{
var ret = JSON.parse(res.action);
}
catch(e)
{
die(action.action + "<br><br>" + res.action);
}
}
successfunction(ret);
}
else
{
@@ -79,13 +82,14 @@ echo '
}).fail(function(jqXHR, status)
{
die(status);
die("AJAX failed: " + status);
});
}
function die(msg)
{
document.body.innerHTML = msg;
var full = "<h1 style=\'color:#900;\'>Fehler:</h1><div>"+msg+"</div>";
document.body.innerHTML = full;
throw new Error(msg);
}
+6 -7
View File
@@ -31,12 +31,12 @@ function returnAJAX($success, $obj)
//if there is an error
if(error_get_last())
$ret = array(
"erfolg" => false,
"return" => false,
);
else if(!$success)
{
$ret = array(
"erfolg" => false,
"return" => false,
"message" => $obj,
);
}
@@ -44,20 +44,19 @@ function returnAJAX($success, $obj)
else if (!$getuid = get_uid())
{
$ret = array(
"erfolg" => false,
"return" => false,
);
}
//if everything worked fine
else
{
$ret = array(
"erfolg" => true,
"user" => $getuid,
"info" => $obj,
"return" => true,
"action" => $obj,
);
}
echo json_encode($ret);
if($ret["erfolg"] === false)
if($ret["return"] === false)
die("");
}
?>