Sempervivum
Erfahrenes Mitglied
Das funktioniert auf meiner Testseite einwandfrei. Du hast doch geschrieben, dass Du es auf dem Webserver hast. Dann poste doch mal die URL.
Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
XHR POST http://192.168.1.44/www/index.php?module=reparaturauftrag&action=edit&id=86
[HTTP/1.1 200 OK 273ms]
meine.js:95:17
4 meine.js:96:5
200 meine.js:97:5
meine.js:98:5
postbefehl=tech_zustand
function sendRequest(id, befehl)
{
var data = "postbefehl=" + befehl;
var xhr = new XMLHttpRequest();
var url = "index.php?module=reparaturauftrag&action=edit&id=" + id;
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onload = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
console.log(xhr.responseText);
console.log(xhr.readyState);
console.log(xhr.status);
console.log(xhr.response);
console.log(data);
//div_tech_zustand.innerHTML = xhr.responseText;
}
};
xhr.send(data);
}
?>
<?php
include ("_gen/reparaturauftrag.php");
//require_once("Payment/DTA.php"); //PEAR
class Reparaturauftrag extends GenReparaturauftrag
{
function __construct(&$app, $intern = false)
{
$this->app=&$app;
if($intern)return false;
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list","ReparaturauftragList");
$this->app->ActionHandler("create","ReparaturauftragCreate");
$this->app->ActionHandler("positionen","ReparaturauftragPositionen");
$this->app->ActionHandler("addposition","ReparaturauftragAddPosition");
...
$this->app->ActionHandler("edit","ReparaturauftragEdit"); // Hier der Sprung bei "index.php?module=reparaturauftrag&action=edit&id=86"
....
function ReparaturauftragEdit()
{
...
$this->app->Tpl->SET('JSSCRIPTS','<script type="text/javascript" src="./js/meine.js"></script>');
$this->app->Tpl->Add('JAVASCRIPT',"CKEDITOR.on('instanceReady', function(){ set_visibility('tech_zustand');});");
$this->app->Tpl->SET('SAVE_TEXT_TECH_ZUSTAND',"<img src=\"themes/new/images/save.png\" alt=\"Bild\" onclick=\"toggle('tech_zustand'); sendRequest($id, 'tech_zustand');\">");
...
// klappt leider nicht
if(isset($_POST['postbefehl'])){
die;
// das auch nicht
$msg = $this->app->Secure->GetPOST("postbefehl");
if($msg=="tech_zustand") die;
}
}
function clickJStoPHP(befehl){
// Daten an Server senden
$.ajax({
// pfad zur PHP Datei (ab HTML Datei)
url: "index.php?module=reparaturauftrag&action=edit&id=86",
// Daten, die an Server gesendet werden soll in JSON Notation
data: {postbefehl: "mach_was"},
dataType: "json",
// Methode POST oder GET
type: "POST",
// Callback-Funktion, die nach der Antwort des Servers ausgefuehrt wird
success: function(data) { }
});
}