Jump to content

Please help refresh part of my web page!


UG1234

Recommended Posts

Hi,

 

I am using Javascript to display a map with a marker (Using OS OpenSpace). However my marker coordinates can change whilst the user is viewing the map so i would like the Marker function code to refresh and re-plot the marker every 10 seconds however i cannot work out how to do this. Adding HTML refresh command <meta http-equiv="refresh" content="10"> obviously causes the whole map to refresh.

 

I have read that AJAX can refresh parts of the webpage without the user knowing but i have no clue how to do this. Can anyone recommend any good tutorials or point me in the right direction please.

 

My code is below, i would like the marker function within the webpage  to refresh

 

Thanks for any help in advance

 

 

<script type="text/javascript">

 

var osMap;

 

function init()

{

osMap = new OpenSpace.Map('map');

 

osMap.setCenter(new OpenSpace.MapPoint(439300, 114760), 8);

 

}

 

function marker()

{

 

var markers = new OpenLayers.Layer.Markers("Markers");

osMap.addLayer(markers);

 

// Default icon

var pos = new OpenSpace.MapPoint(438760, 114760);

var marker = new OpenLayers.Marker(pos);

 

markers.addMarker(marker);

}

 

</script>

</head>

<body onload="init(); marker()">

 

Thanks for any help in advance

Link to comment
https://forums.phpfreaks.com/topic/189903-please-help-refresh-part-of-my-web-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.