Variable von html in JS übergeben.

Ja das war nur testweise so wenig, ich tippe mir ja dann den wolf wenn ich das mit Hand mache.
Im endefekt schaut es so aus:
Code:
function updatewetter()
{  
    $.ajax({
      url: "wetter_01.htm",
    type: "POST",
    success: function(response)
    {
            var myParw = response.split(",");
      $("#para_004").html(myParw[0]);
      chartdata1 = [myParw[0],myParw[1],myParw[2],myParw[3],myParw[4],];

jetzt kann ich alles einmalig mit Hand eingeben, oder ich befülle die Variabel chartdata1 in einer Schleife.

In PHP würde ich es so machen inerhalb einer schleife
Code:
$chartdata1= "";// vor der Schleife erstmal leeren

$chartdata1= $chartdata1. $myParw[$c_zaehler] . ", ";

In Basic:
$chartdata1= $chartdata1 + $myParw[$c_zaehler] + ", ";
 
Ah ja, jetzt verstehe ich, die Daten sind schon da in der Antwort vom Server. Dann ist es ganz einfach, denn eigentlich hast Du ja schon das Array, das Du brauchst, in der Variablen myParw:
Code:
chartdata1 = myParw;
bzw.:
Code:
        var outData =
        {
            labels : ["18:30","","16:30","","14:30","","12:30","","10:30","","08:30","","06:30","","04:30","","02:30","","00:30","","23:30","","21:30","","19:30","","17:30","","15:30","","13:30","","11:30","","09:30","","07:30","","05:30","","03:30","","01:30","","23:30","","21:30","",],
            datasets : [
                {
                    fillColor : "rgba(151,187,205,0.2)",
                    strokeColor : "#97BBCD",
                    pointColor : "#e0f6f1",
                    pointStrokeColor : "#97BBCD",
                    data : myParw
                }         
            ]
        };
 
Zurück