Hey,
mal wieder ein Problem.
Folgender Code:
Datei 1 "ajax.php":
Datei 2
Ausgabe auf der Konsole:
4
4
Ich möchte aber gerne:
4.5
4.7
Kann mir da jemand helfen? Ich will einfach nur meine Float Variablen von
php auf einer anderen Seite in javascript darstellen und das all 120 ms.
mal wieder ein Problem.
Folgender Code:
Datei 1 "ajax.php":
PHP-Code:
<?php
$change = array(floatval(4.5),floatval(4.7));
echo json_encode($change);
?>
Code:
<html> <head> </head> <body> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> var x; var y; (function worker() { $.get("ajax.php", function(data){ var duce = jQuery.parseJSON(data); x = parseFloat(duce[0]); y = parseFloat(duce[1]); console.log(x); console.log(y); }); setTimeout(worker, 120); })(); </script> </body> </html>
4
4
Ich möchte aber gerne:
4.5
4.7
Kann mir da jemand helfen? Ich will einfach nur meine Float Variablen von
php auf einer anderen Seite in javascript darstellen und das all 120 ms.
Kommentar