Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Ajax

Empfohlene Antworten

Veröffentlicht

Hi,

Ich entwickle eine Search-page und will dabei dass Eingabefelder beim klick auf einem Link dynamisch auftauchen. Ich benutze eclipse PHP als Entwicklungsumgebung und XAMPP für den lokalen Server. Der relevante code im <head> innerhalb einer Funktion loadXMLDoc()":

xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","SearchForm.php",true);
xmlhttp.send();[/PHP]

SearchForm.php enthält nur den inhalt zwischen <form>....</form>. Und myDiv ist im body definiert:

[PHP]<div id="myDiv"> </div>

Die Funktion loadXMLDoc() wird ebenfalls im body aufgerufen:

<button type="button" onclick="loadXMLDoc()">New Search</button>

In Eclipse,beim debugging funktioniert mein code: beim klicken auf "New Search" erscheint der in SearchForm.php spezifizierte Inhalt. Nicht aber in Firefox. Ich hab es auch mit einem einfachen textfile ausprobiert, hat aber auch nicht funktioniert (Mit Explorer funktioniert gar nichts, aber das ist im Moment nicht wichtig, ich möchte zunächst dass es in firefox läuft)

Kann mir jemand weiterhelfen?

Was sagt denn die Firefox Fehler-Konsole?

Sie sagt:

Fehler: nicht wohlgeformt

Quelldatei: .../SearchForm2.php

Zeile: 1, Spalte: 14

Quelltext:

<form method=post enctype=multipart/form-data action=processor.php

und der pfeil zeigt auf post.

attribute von tags müssen in "" gesetzt werden also in dem fall: <form method="post" enctype="multipart....

innerHTML ist übrigens nicht DOM konform, was wohl ein problem wird wenn du mit dem eingefügten schnipser noch irgendetwas tun willst.

Es funktioniert jetzt! Aber an den fehlenden "" lag es nicht (die fehlen immer noch). Ich hab an dem Format gearbeitet und dabei bestimmte Attribute bei den einzelnen Eingabefeldern geändert, wahrscheinlich war da etwas nicht in Ordnung... leider hab ich die alte Version nicht mehr und kann es nicht ganz nachvollziehen. Danke!

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.