Kleine Vragen Topic #4

Gestart doorOne2xs1.965 reacties23.994 weergaven

1.966 berichten · pagina 109 van 132

Berichten
1.644
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heeft iemand een idee waarom mijn google maps niet altijd laad op mn website?
Voorbeeld: https://jorzwa.com/ (Als je op contact drukt, soms moet je paar keer refreshen om te zien dat die laad of niet laad)

googlemaps.js
Spoiler tonen
/* api key AIzaSyBl3_Il4JJr-n9d63-w7tqMSlPsbWxTnHs */
// The latitude and longitude of your business / place
$(document).ready(function(){
  var position = [52.776723, 6.925278];

  function showGoogleMaps() {

      var latLng = new google.maps.LatLng(position[0], position[1]);

      var mapOptions = {
          zoom: 16, // initialize zoom level - the max value is 21
          streetViewControl: false, // hide the yellow Street View pegman
          scaleControl: true, // allow users to zoom the Google Map
          disableDefaultUI: true,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          center: latLng,
          styles: [
            {elementType: geometry, stylers: [{color: #303038}]},
            {elementType: labels.text.stroke, stylers: [{color: #303038}]},
            {elementType: labels.text.fill, stylers: [{color: #777c80}]},
            {
              featureType: administrative.locality,
              elementType: labels.text.fill,
              stylers: [{color: #d59563}]
            },
            {
              featureType: poi,
              elementType: labels.text.fill,
              stylers: [{color: #ea714c}]
            },
            {
              featureType: poi.park,
              elementType: geometry,
              stylers: [{color: #303038}]
            },
            {
              featureType: poi.park,
              elementType: labels.text.fill,
              stylers: [{color: #6b9a76}]
            },
            {
              featureType: road,
              elementType: geometry,
              stylers: [{color: #38414e}]
            },
            {
              featureType: road,
              elementType: geometry.stroke,
              stylers: [{color: #212a37}]
            },
            {
              featureType: road,
              elementType: labels.text.fill,
              stylers: [{color: #9ca5b3}]
            },
            {
              featureType: road.highway,
              elementType: geometry,
              stylers: [{color: #777c80}]
            },
            {
              featureType: road.highway,
              elementType: geometry.stroke,
              stylers: [{color: #1f2835}]
            },
            {
              featureType: road.highway,
              elementType: labels.text.fill,
              stylers: [{color: #f3d19c}]
            },
            {
              featureType: transit,
              elementType: geometry,
              stylers: [{color: #2f3948}]
            },
            {
              featureType: transit.station,
              elementType: labels.text.fill,
              stylers: [{color: #d59563}]
            },
            {
              featureType: water,
              elementType: geometry,
              stylers: [{color: #17263c}]
            },
            {
              featureType: water,
              elementType: labels.text.fill,
              stylers: [{color: #515c6d}]
            },
            {
              featureType: water,
              elementType: labels.text.stroke,
              stylers: [{color: #17263c}]
            }
          ]

      };

      map = new google.maps.Map(document.getElementById(googlemaps),
          mapOptions);

      // Show the default red marker at the location
      marker = new google.maps.Marker({
          position: latLng,
          map: map,
          draggable: false,
          animation: google.maps.Animation.DROP
      });
  }

  google.maps.event.addDomListener(window, load, showGoogleMaps);
});
0
Stef

Lid

Berichten
10.150
Reputatie
2
Punten
0,00
Lid sinds
Laatst gezien
Jorzwa schreef:
Heeft iemand een idee waarom mijn google maps niet altijd laad op mn website?
Voorbeeld: https://jorzwa.com/ (Als je op contact drukt, soms moet je paar keer refreshen om te zien dat die laad of niet laad)

googlemaps.js
Spoiler tonen
/* api key AIzaSyBl3_Il4JJr-n9d63-w7tqMSlPsbWxTnHs */
// The latitude and longitude of your business / place
$(document).ready(function(){
  var position = [52.776723, 6.925278];

  function showGoogleMaps() {

      var latLng = new google.maps.LatLng(position[0], position[1]);

      var mapOptions = {
          zoom: 16, // initialize zoom level - the max value is 21
          streetViewControl: false, // hide the yellow Street View pegman
          scaleControl: true, // allow users to zoom the Google Map
          disableDefaultUI: true,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          center: latLng,
          styles: [
            {elementType: geometry, stylers: [{color: #303038}]},
            {elementType: labels.text.stroke, stylers: [{color: #303038}]},
            {elementType: labels.text.fill, stylers: [{color: #777c80}]},
            {
              featureType: administrative.locality,
              elementType: labels.text.fill,
              stylers: [{color: #d59563}]
            },
            {
              featureType: poi,
              elementType: labels.text.fill,
              stylers: [{color: #ea714c}]
            },
            {
              featureType: poi.park,
              elementType: geometry,
              stylers: [{color: #303038}]
            },
            {
              featureType: poi.park,
              elementType: labels.text.fill,
              stylers: [{color: #6b9a76}]
            },
            {
              featureType: road,
              elementType: geometry,
              stylers: [{color: #38414e}]
            },
            {
              featureType: road,
              elementType: geometry.stroke,
              stylers: [{color: #212a37}]
            },
            {
              featureType: road,
              elementType: labels.text.fill,
              stylers: [{color: #9ca5b3}]
            },
            {
              featureType: road.highway,
              elementType: geometry,
              stylers: [{color: #777c80}]
            },
            {
              featureType: road.highway,
              elementType: geometry.stroke,
              stylers: [{color: #1f2835}]
            },
            {
              featureType: road.highway,
              elementType: labels.text.fill,
              stylers: [{color: #f3d19c}]
            },
            {
              featureType: transit,
              elementType: geometry,
              stylers: [{color: #2f3948}]
            },
            {
              featureType: transit.station,
              elementType: labels.text.fill,
              stylers: [{color: #d59563}]
            },
            {
              featureType: water,
              elementType: geometry,
              stylers: [{color: #17263c}]
            },
            {
              featureType: water,
              elementType: labels.text.fill,
              stylers: [{color: #515c6d}]
            },
            {
              featureType: water,
              elementType: labels.text.stroke,
              stylers: [{color: #17263c}]
            }
          ]

      };

      map = new google.maps.Map(document.getElementById(googlemaps),
          mapOptions);

      // Show the default red marker at the location
      marker = new google.maps.Marker({
          position: latLng,
          map: map,
          draggable: false,
          animation: google.maps.Animation.DROP
      });
  }

  google.maps.event.addDomListener(window, load, showGoogleMaps);
});


Quote:
js?key=AIzaSyBl3_Il4JJr-n9d63-w7tqMSlPsbWxTnHs:93 You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

De error is toch best duidelijk? yummie
0
Berichten
1.644
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Stef schreef:
Eerdere citaten tonen
Jorzwa schreef:
Heeft iemand een idee waarom mijn google maps niet altijd laad op mn website?
Voorbeeld: https://jorzwa.com/ (Als je op contact drukt, soms moet je paar keer refreshen om te zien dat die laad of niet laad)

googlemaps.js
Spoiler tonen
/* api key AIzaSyBl3_Il4JJr-n9d63-w7tqMSlPsbWxTnHs */
// The latitude and longitude of your business / place
$(document).ready(function(){
  var position = [52.776723, 6.925278];

  function showGoogleMaps() {

      var latLng = new google.maps.LatLng(position[0], position[1]);

      var mapOptions = {
          zoom: 16, // initialize zoom level - the max value is 21
          streetViewControl: false, // hide the yellow Street View pegman
          scaleControl: true, // allow users to zoom the Google Map
          disableDefaultUI: true,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          center: latLng,
          styles: [
            {elementType: geometry, stylers: [{color: #303038}]},
            {elementType: labels.text.stroke, stylers: [{color: #303038}]},
            {elementType: labels.text.fill, stylers: [{color: #777c80}]},
            {
              featureType: administrative.locality,
              elementType: labels.text.fill,
              stylers: [{color: #d59563}]
            },
            {
              featureType: poi,
              elementType: labels.text.fill,
              stylers: [{color: #ea714c}]
            },
            {
              featureType: poi.park,
              elementType: geometry,
              stylers: [{color: #303038}]
            },
            {
              featureType: poi.park,
              elementType: labels.text.fill,
              stylers: [{color: #6b9a76}]
            },
            {
              featureType: road,
              elementType: geometry,
              stylers: [{color: #38414e}]
            },
            {
              featureType: road,
              elementType: geometry.stroke,
              stylers: [{color: #212a37}]
            },
            {
              featureType: road,
              elementType: labels.text.fill,
              stylers: [{color: #9ca5b3}]
            },
            {
              featureType: road.highway,
              elementType: geometry,
              stylers: [{color: #777c80}]
            },
            {
              featureType: road.highway,
              elementType: geometry.stroke,
              stylers: [{color: #1f2835}]
            },
            {
              featureType: road.highway,
              elementType: labels.text.fill,
              stylers: [{color: #f3d19c}]
            },
            {
              featureType: transit,
              elementType: geometry,
              stylers: [{color: #2f3948}]
            },
            {
              featureType: transit.station,
              elementType: labels.text.fill,
              stylers: [{color: #d59563}]
            },
            {
              featureType: water,
              elementType: geometry,
              stylers: [{color: #17263c}]
            },
            {
              featureType: water,
              elementType: labels.text.fill,
              stylers: [{color: #515c6d}]
            },
            {
              featureType: water,
              elementType: labels.text.stroke,
              stylers: [{color: #17263c}]
            }
          ]

      };

      map = new google.maps.Map(document.getElementById(googlemaps),
          mapOptions);

      // Show the default red marker at the location
      marker = new google.maps.Marker({
          position: latLng,
          map: map,
          draggable: false,
          animation: google.maps.Animation.DROP
      });
  }

  google.maps.event.addDomListener(window, load, showGoogleMaps);
});

Quote:
js?key=AIzaSyBl3_Il4JJr-n9d63-w7tqMSlPsbWxTnHs:93 You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

De error is toch best duidelijk? yummie
Heb hem er maar 1x in staan dus snap die error niet bloos
0
Stef

Lid

Berichten
10.150
Reputatie
2
Punten
0,00
Lid sinds
Laatst gezien
Jorzwa schreef:
Eerdere citaten tonen
Stef schreef:
Eerdere citaten tonen
Jorzwa schreef:
Heeft iemand een idee waarom mijn google maps niet altijd laad op mn website?
Voorbeeld: https://jorzwa.com/ (Als je op contact drukt, soms moet je paar keer refreshen om te zien dat die laad of niet laad)

googlemaps.js
Spoiler tonen
/* api key AIzaSyBl3_Il4JJr-n9d63-w7tqMSlPsbWxTnHs */
// The latitude and longitude of your business / place
$(document).ready(function(){
  var position = [52.776723, 6.925278];

  function showGoogleMaps() {

      var latLng = new google.maps.LatLng(position[0], position[1]);

      var mapOptions = {
          zoom: 16, // initialize zoom level - the max value is 21
          streetViewControl: false, // hide the yellow Street View pegman
          scaleControl: true, // allow users to zoom the Google Map
          disableDefaultUI: true,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          center: latLng,
          styles: [
            {elementType: geometry, stylers: [{color: #303038}]},
            {elementType: labels.text.stroke, stylers: [{color: #303038}]},
            {elementType: labels.text.fill, stylers: [{color: #777c80}]},
            {
              featureType: administrative.locality,
              elementType: labels.text.fill,
              stylers: [{color: #d59563}]
            },
            {
              featureType: poi,
              elementType: labels.text.fill,
              stylers: [{color: #ea714c}]
            },
            {
              featureType: poi.park,
              elementType: geometry,
              stylers: [{color: #303038}]
            },
            {
              featureType: poi.park,
              elementType: labels.text.fill,
              stylers: [{color: #6b9a76}]
            },
            {
              featureType: road,
              elementType: geometry,
              stylers: [{color: #38414e}]
            },
            {
              featureType: road,
              elementType: geometry.stroke,
              stylers: [{color: #212a37}]
            },
            {
              featureType: road,
              elementType: labels.text.fill,
              stylers: [{color: #9ca5b3}]
            },
            {
              featureType: road.highway,
              elementType: geometry,
              stylers: [{color: #777c80}]
            },
            {
              featureType: road.highway,
              elementType: geometry.stroke,
              stylers: [{color: #1f2835}]
            },
            {
              featureType: road.highway,
              elementType: labels.text.fill,
              stylers: [{color: #f3d19c}]
            },
            {
              featureType: transit,
              elementType: geometry,
              stylers: [{color: #2f3948}]
            },
            {
              featureType: transit.station,
              elementType: labels.text.fill,
              stylers: [{color: #d59563}]
            },
            {
              featureType: water,
              elementType: geometry,
              stylers: [{color: #17263c}]
            },
            {
              featureType: water,
              elementType: labels.text.fill,
              stylers: [{color: #515c6d}]
            },
            {
              featureType: water,
              elementType: labels.text.stroke,
              stylers: [{color: #17263c}]
            }
          ]

      };

      map = new google.maps.Map(document.getElementById(googlemaps),
          mapOptions);

      // Show the default red marker at the location
      marker = new google.maps.Marker({
          position: latLng,
          map: map,
          draggable: false,
          animation: google.maps.Animation.DROP
      });
  }

  google.maps.event.addDomListener(window, load, showGoogleMaps);
});

Quote:
js?key=AIzaSyBl3_Il4JJr-n9d63-w7tqMSlPsbWxTnHs:93 You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

De error is toch best duidelijk? yummie
Heb hem er maar 1x in staan dus snap die error niet bloos
Nu krijg ik de error Uncaught ReferenceError: google is not defined
Google eens op die fout smile
0
Berichten
1.644
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waar vind je die errors eigenlijk als ik in mijn console kijk zie ik ze niet (firefox)
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Ctrl+SHIFT+J, en dan krijg je de console.
Die is verdeeld in een aantal tabjes, waaronder CSS en JS.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Ik loop op dit moment even ergens op vast. Ik heb een externe CSV die ik wil uitlezen in een bepaalde formaat:

In het bestand met ruim 30.000 regels staat o.a. als als tweede getal de dag van zo t/m za (0 t/m 6), en daarna het type materieel en dan op het nummer.

8845,0,DDZ
8845,1,ICM
8845,2,ICM
8845,3,DDZ
8845,4,ICM
8845,5,IRM
8845,6,ICM


Nu wil ik dus de regels uitlezen op een snelle manier en verwerken tot een string waarin ze gegroepeerd zijn op materieel:

--W---Z    8845    DDZ
MD-DZ-    8845    ICM
----V--    8845    IRM


Ik heb geen flauw idee hoe dit op een fatsoenlijke manier kan uitlezen:

[COLOR= #0000BB]<?php
$file[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file"]file[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"data/20161211.csv"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$inzet[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]  

[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$file[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700]) {[/COLOR]
    
    [COLOR= #0000BB]$split[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$inzet[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$split[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]]] =[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$split[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]],[/COLOR][COLOR= #0000BB]$split[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]],[/COLOR][COLOR= #0000BB]$split[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700]]);
 
}[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"FORUMCODE0"[/COLOR][COLOR= #007700];[/COLOR]   

[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$inzet[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$k[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$v[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$v[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]"<br>n"[/COLOR][COLOR= #007700].[/COLOR]PHP_EOL[COLOR= #007700];
}[/COLOR]
?>


Ik loop een beetje vast nu. Iemand die me op weg kan helpen?
Het gaat om ruim 30.000 van zulke regels in het CSV-bestand.

Hoe krijg ik ze o.a gegroepeerd op het nummer en het materieel?
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Ik loop op dit moment even ergens op vast. Ik heb een externe CSV die ik wil uitlezen in een bepaalde formaat:

In het bestand met ruim 30.000 regels staat o.a. als als tweede getal de dag van zo t/m za (0 t/m 6), en daarna het type materieel en dan op het nummer.

8845,0,DDZ
8845,1,ICM
8845,2,ICM
8845,3,DDZ
8845,4,ICM
8845,5,IRM
8845,6,ICM
Nu wil ik dus de regels uitlezen op een snelle manier en verwerken tot een string waarin ze gegroepeerd zijn op materieel:

--W---Z    8845    DDZ
MD-DZ-    8845    ICM
----V--    8845    IRM


Ik heb geen flauw idee hoe dit op een fatsoenlijke manier kan uitlezen:

[knip]

Ik loop een beetje vast nu. Iemand die me op weg kan helpen?
Het gaat om ruim 30.000 van zulke regels in het CSV-bestand.

Hoe krijg ik ze o.a gegroepeerd op het nummer en het materieel?

Zo even snel uit mijn hoofd:

[COLOR= #0000BB]<?php

$csvFile[/COLOR]    [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file"]file[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]aar.csv[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$returnArr[/COLOR]  [COLOR= #007700]= [];[/COLOR]  

[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$csvFile[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700]) 
{[/COLOR]
    [COLOR= #0000BB]$rowSplit[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000],[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700]);[/COLOR]
    
    [COLOR= #FF8000]// Check if it exists in the array already[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/array_key_exists"]array_key_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$rowSplit[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$returnArr[/COLOR][COLOR= #007700]))
    {[/COLOR]
        [COLOR= #FF8000]// Key doesnt exist, create the key[/COLOR]
        [COLOR= #0000BB]$returnArr[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$rowSplit[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]]] = [];
    }[/COLOR]
        
    [COLOR= #0000BB]$train[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"n"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$rowSplit[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700]]);[/COLOR]
        
    [COLOR= #FF8000]// Key already exists, check if the train already exists[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/array_key_exists"]array_key_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$train[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$returnArr[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$rowSplit[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]]]))
    {[/COLOR]
        [COLOR= #FF8000]// Train doesnt exist, create the key[/COLOR]
        [COLOR= #0000BB]$returnArr[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$rowSplit[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]]][[/COLOR][COLOR= #0000BB]$train[/COLOR][COLOR= #007700]] = [];
    }[/COLOR]
        
    [COLOR= #0000BB]$returnArr[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$rowSplit[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]]][[/COLOR][COLOR= #0000BB]$train[/COLOR][COLOR= #007700]][] =[/COLOR] [COLOR= #0000BB]$rowSplit[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]];
}[/COLOR]

[URL="http://www.php.net/var_dump"]var_dump[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$returnArr[/COLOR][COLOR= #007700]);[/COLOR]


Dit geeft een multidimensionale array terug, namelijk:

array(1) {
  [8845]=>
  array(3) {
    ["DDZ"]=>
    array(2) {
      [0]=>
      string(1) "0"
      [1]=>
      string(1) "3"
    }
    ["ICM"]=>
    array(4) {
      [0]=>
      string(1) "1"
      [1]=>
      string(1) "2"
      [2]=>
      string(1) "4"
      [3]=>
      string(1) "6"
    }
    ["IRM"]=>
    array(1) {
      [0]=>
      string(1) "5"
    }
  }
}
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Wow, thanks. Ziet er op het eerste ogenblik goed uit.
Ik ga er even verder mee rommelen. smile
0
Marv

Lid

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Hallo Allemaal,

Ik wil graag een tekst van een phpfile ophalen met javascript om realtime te verversen.. iemand die me kan helpen hoe ik dit doe?

Google vindt ook weinig..
0
Stef

Lid

Berichten
10.150
Reputatie
2
Punten
0,00
Lid sinds
Laatst gezien
Marvinguich schreef:
Hallo Allemaal,

Ik wil graag een tekst van een phpfile ophalen met javascript om realtime te verversen.. iemand die me kan helpen hoe ik dit doe?

Google vindt ook weinig..
Dat wil je doen met een AJAX request winkZoals ik dat bij het email formulier op stefvanderwel.nl heb gemaakt smile
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Voor Treinenweb doe ik dat ook met de vertrektijden. Wel met een portie jQuery.
De omgebouwde code voor een refresh van 5 minuten:

$(document).ready(function(){
loadData(); // laad de functie.

function loadData() {
        $.ajax({
            url: "script.php,
            cache: false,
            success: function(html){
                $(".result").empty().html(html);
                setTimeout(function () { 
                    loadData(); 
                }, 5000); // 5 seconden!
            },
            error:function (xhr, ajaxOptions, thrownError){
                    $(".result").empty().html(Er is een fout opgetreden:+ xhr.status +  + thrownError);
                  }    
        });
    }
});


Uiteindelijk, als alles goed is, komt de data terecht in een HTML-element met de class result.
0
Stef

Lid

Berichten
10.150
Reputatie
2
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Voor Treinenweb doe ik dat ook met de vertrektijden. Wel met een portie jQuery.
De omgebouwde code voor een refresh van 5 minuten:
$(document).ready(function(){
loadData(); // laad de functie.

function loadData() {
        $.ajax({
            url: "script.php,
            cache: false,
            success: function(html){
                $(".result").empty().html(html);
                setTimeout(function () { 
                    loadData(); 
                }, 5000); // 5 seconden!
            },
            error:function (xhr, ajaxOptions, thrownError){
                    $(".result").empty().html(Er is een fout opgetreden:+ xhr.status +  + thrownError);
                  }    
        });
    }
});


Uiteindelijk, als alles goed is, komt de data terecht in een HTML-element met de class result.

Waarom maak je .result eerst leeg voordat je er de html in zet? Je kan .empty() toch gewoon weglaten?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Lijkt me inderdaad overbodig, nu ik het zie.
0
Marv

Lid

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Aarclay schreef:
Voor Treinenweb doe ik dat ook met de vertrektijden. Wel met een portie jQuery.
De omgebouwde code voor een refresh van 5 minuten:
$(document).ready(function(){
loadData(); // laad de functie.

function loadData() {
        $.ajax({
            url: "script.php,
            cache: false,
            success: function(html){
                $(".result").empty().html(html);
                setTimeout(function () { 
                    loadData(); 
                }, 5000); // 5 seconden!
            },
            error:function (xhr, ajaxOptions, thrownError){
                    $(".result").empty().html(Er is een fout opgetreden:+ xhr.status +  + thrownError);
                  }    
        });
    }
});


Uiteindelijk, als alles goed is, komt de data terecht in een HTML-element met de class result.

Thanks! Werkend gekregen met jouw scriptje smile
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren