Al een tijdje ben ik bezig om google maps te programmeren en dit gaat aardig. Nu wil ik naast alle info, die ik haal uit een php script die gelinkt is aan een api, ook een media player die uit hetzelfde php script de url ophaalt van het mp3tje die moet worden afgespeeld. Het lukt wel om de looks van de media player weer te geven, maar deze divjes kunnen het bijbehorende javascript niet vinden. Als ik deze code in een los html pagina zet werkt alles, zonder problemen. Hieronder staat de complete code waar het om draaid
[JS]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="jplayer.blue.monday.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>shoudio verbindig test</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDFUbv6XEO15bVG9gMmwaCgwugVKBwnDes&sensor=true"></script>
<script type="text/javascript" src="http://localhost/wordpress/jPlayer/jquery.jplayer.min.js"></script>
<SCRIPT TYPE="text/javascript">
var input = 'henk';
$.ajax({
url: 'http://localhost/wordpress/shoudio.php',
type: 'GET',
dataType: 'json',
success: function(data) {
input = data.shoudios;
/*
$.each(data.shoudios, function(i,shoudio){
alert(shoudio.id);
});*/
alles()
},
error: function() { alert('boo!'); },
});
function alles(){
//Variable declareren.
var image = 'http://localhost/wordpress/testlogosmallblack.png';
$.each(input, function(i, shoudio){
window['contentString'+i] = '<div id="content"><div id="siteNotice">'+ shoudio.created_at +'</div><h2 id="firstHeading">'+ shoudio.message +'</h2><div id="bodyContent">'+shoudio.username+'</div></div><div id="extrainfo'+shoudio.id+'"><div id="jquery_jplayer_1" class="jp-jplayer"></div><div id="jp_container_1" class="jp-audio"><div class="jp-type-single"><div class="jp-gui jp-interface"><ul class="jp-controls"><li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li><li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li><li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li><li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li><li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li><li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li></ul><div class="jp-progress"><div class="jp-seek-bar"><div class="jp-play-bar"></div></div></div><div class="jp-volume-bar"><div class="jp-volume-bar-value"></div></div><div class="jp-current-time"></div><div class="jp-duration"></div></div></div></div></div><div class="fb-like" data-href="http://www.mytotem.nl/" data-send="true" data-width="450" data-show-faces="false" data-font="lucida grande"></div>';
window['infowindow'+i] = new google.maps.InfoWindow({
content: window['contentString'+i]
});
window['markerpoint'+i] = new google.maps.LatLng(shoudio.lat, shoudio.lon);
});
//Marker toevoegen
function addMarker(positieMarker,infowindow) {
var marker = new google.maps.Marker({
position: positieMarker,
map: map,
icon:image
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
initialize();
//Alles initializeren
function initialize() {
var mapOptions = {
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center:new google.maps.LatLng(52.1750, 4.7916)
};
map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
$.each(input, function(i, shoudio){
addMarker(window['markerpoint'+i],window['infowindow'+i]);
});
}
}
</SCRIPT>
<script type="javascript/text">
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/nl_NL/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div id ="jp-jplayer"></div>
<script>
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
$(this).jPlayer("setMedia", {
mp3:"audio.mp3"
});
},
swfPath: "../js",
wmode: "window"
});
});
</script>
</head>
<body >
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
[/JS]
Dit geeft hij weer:

Na Shoudio ID op regel 43 begint de mediaplayer tot en met de 5 x </div>. Deze zou het script (beginnend op regel 102 t/m 112) moeten ophalen.
Het laatste stuk (op regel 43) is de code die de facebook like button moet weergeven. Deze zou het script direct onder die van de media player moeten ophalen, dit wordt ook niet gedaan.
Wie weet wat ik fout doe en hoe ik dit moet oplossen??
[JS]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="jplayer.blue.monday.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>shoudio verbindig test</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDFUbv6XEO15bVG9gMmwaCgwugVKBwnDes&sensor=true"></script>
<script type="text/javascript" src="http://localhost/wordpress/jPlayer/jquery.jplayer.min.js"></script>
<SCRIPT TYPE="text/javascript">
var input = 'henk';
$.ajax({
url: 'http://localhost/wordpress/shoudio.php',
type: 'GET',
dataType: 'json',
success: function(data) {
input = data.shoudios;
/*
$.each(data.shoudios, function(i,shoudio){
alert(shoudio.id);
});*/
alles()
},
error: function() { alert('boo!'); },
});
function alles(){
//Variable declareren.
var image = 'http://localhost/wordpress/testlogosmallblack.png';
$.each(input, function(i, shoudio){
window['contentString'+i] = '<div id="content"><div id="siteNotice">'+ shoudio.created_at +'</div><h2 id="firstHeading">'+ shoudio.message +'</h2><div id="bodyContent">'+shoudio.username+'</div></div><div id="extrainfo'+shoudio.id+'"><div id="jquery_jplayer_1" class="jp-jplayer"></div><div id="jp_container_1" class="jp-audio"><div class="jp-type-single"><div class="jp-gui jp-interface"><ul class="jp-controls"><li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li><li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li><li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li><li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li><li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li><li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li></ul><div class="jp-progress"><div class="jp-seek-bar"><div class="jp-play-bar"></div></div></div><div class="jp-volume-bar"><div class="jp-volume-bar-value"></div></div><div class="jp-current-time"></div><div class="jp-duration"></div></div></div></div></div><div class="fb-like" data-href="http://www.mytotem.nl/" data-send="true" data-width="450" data-show-faces="false" data-font="lucida grande"></div>';
window['infowindow'+i] = new google.maps.InfoWindow({
content: window['contentString'+i]
});
window['markerpoint'+i] = new google.maps.LatLng(shoudio.lat, shoudio.lon);
});
//Marker toevoegen
function addMarker(positieMarker,infowindow) {
var marker = new google.maps.Marker({
position: positieMarker,
map: map,
icon:image
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
initialize();
//Alles initializeren
function initialize() {
var mapOptions = {
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center:new google.maps.LatLng(52.1750, 4.7916)
};
map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
$.each(input, function(i, shoudio){
addMarker(window['markerpoint'+i],window['infowindow'+i]);
});
}
}
</SCRIPT>
<script type="javascript/text">
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/nl_NL/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div id ="jp-jplayer"></div>
<script>
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function (event) {
$(this).jPlayer("setMedia", {
mp3:"audio.mp3"
});
},
swfPath: "../js",
wmode: "window"
});
});
</script>
</head>
<body >
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
[/JS]
Dit geeft hij weer:

Na Shoudio ID op regel 43 begint de mediaplayer tot en met de 5 x </div>. Deze zou het script (beginnend op regel 102 t/m 112) moeten ophalen.
Het laatste stuk (op regel 43) is de code die de facebook like button moet weergeven. Deze zou het script direct onder die van de media player moeten ophalen, dit wordt ook niet gedaan.
Wie weet wat ik fout doe en hoe ik dit moet oplossen??
Laatst bewerkt: