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.

if anweisung richtiger Wert wird als falscher erkannt

Empfohlene Antworten

Veröffentlicht

Hi,

folgende Situation:

Ich nutze das Framework "prototype"

Das Skript:

		<script type='text/javascript'>

		function ajax_refresh(time_to_wait)

		{

			new Ajax.Request('/url', 

			{

				method:'get',

  				onSuccess: function(transport)

  				{

     					var response = transport.responseText;

     					var response = response.split('@');

     					var zahl = response[0];

     					var answer = response[1];

     					document.getElementById('ajax_status').innerHTML = answer;

     					if(zahl == '0')

     					{

     						window.setTimeout('ajax_refresh(2200);',time_to_wait);

     					}

     					elseif(typeof(zahl) == '1')

     					{


window.setTimeout('ajax_refresh(2200);',time_to_wait);

     					}

     					elseif(zahl == '2')

     					{

     						window.setTimeout('ajax_refresh(2200);',time_to_wait);

     					}

     					elseif(zahl == '3')

     					{

     						pass;

     					}


   				}

			});

		}

		ajax_refresh(2200);

		</script>
So das PHP-Skript gibt folgendes zurück bei einer Anfrage:
echo("1@Randomtext");

Wie das skript oben auch sagt splitet es diese ausgabe bei "@".

dann steht in der Variable zahl eine 1, aber er macht nicht weiter das window wird nicht refreshed.

Ich habe dort auch schon mit alerts gearbeitet er gibt definitiv nichts zurück, also er kommt nicht durch den if-Zweig

Wo liegt das Problem?

mfg

var response = transport.responseText;

var response = response.split('@');

Fällt dir da was auf?

Um ehrlich zu sein: Nein

Meine Blindheit kennt keine Grenzen:

Wenn man syntaktische Fehler nicht sieht sollte man wohl lieber nen Debugger nutzen...

Naja jedenfalls wird elseif in JS else if geschrieben >.<

Ich bin wohl PHP geschädigt. ^^

Naja

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.