I\'ve been having trouble getting Google Maps API v3 to update correctly. I\'ve got a javascript timer running that should be refreshing the traffic layer periodic
The way you are refreshing the layer is working fine.
Here is your code edited to prove this:
Map Testing
I added a visibility property to toggle the layer every 2 seconds. You will notice how it turns on and off. Because the way you called it I think it did not have enough time to refresh.
Also I added the interval in the initMap function after the layer's map was first set.
Hope that helps.
EDIT. Just to add to this, where the traffic is real time where supported, in some cases its based on historic data and will not refresh over a short period. But the traffic data is fetched at the time of each request as specified in the docs: https://developers.google.com/maps/documentation/javascript/trafficlayer#traffic_layer