Jeg har en side som hedder latestposition.php.
Meningen er at den skal vise et google map
Dette her script virker fint, hvis man går ind på siden DIREKTE fra addresse-baren:
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAATccivc2yk9iDlRNANcn_9BSKvN9kLo03cnaerKrQ_UeYokqROxSx_BCYKmTbikatOvxf-ICQQLQTqw"></script>
<script type="text/javascript">
google.load("maps", "2.x");
// Call this function when the page has been loaded
function initialize() {
var map = new google.maps.Map2(document.getElementById("map"));
map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);
}
google.setOnLoadCallback(initialize);
</script>
</head>
<body onload="initialize()">
<div id="map" style="width: 200px; height: 200px">
</div>
<p>test</p>
</body>
Men når jeg bruger nedenstående AJAX funktion til at vise latestposition.php i en DIV på forsiden, viser den ikke google mappet men kun teksten "test" ..
/***********************************************
* Ajax Includes script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at
http://www.dynamicdrive.com/ for full source code
***********************************************/
//To include a page, invoke ajaxinclude("afile.htm") in the BODY of page
//Included file MUST be from the same domain as the page displaying it.
var rootdomain="http://"+window.location.hostname
function ajaxinclude(url, containerid) {
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.open('GET', url, false) //get page synchronously
page_request.send(null)
writecontent(page_request, containerid)
}
function writecontent(page_request, containerid){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
document.getElementById(containerid).innerHTML=page_request.responseText;
}
-----------------------------------
Nogen der ved hvordan jeg fixer dette problem, så google mappet også bliver vist, og ikke kun teksten??
Indlæg senest redigeret d. 02.07.2010 21:47 af Bruger #15981