Changeset 9177 for src/django_gheat
- Timestamp:
- May 11, 2011, 12:17:18 PM (14 years ago)
- Location:
- src/django_gheat/website
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/static/heatmap.js
r9175 r9177 24 24 var lonlat = map.getLonLatFromPixel(pixel); 25 25 var mousepos = OpenLayers.Layer.SphericalMercator.inverseMercator(lonlat.lon, lonlat.lat); 26 loadXMLDoc(mousepos); 27 //var url = "/website/wlnode/" + mousepos.lat + "," + mousepos.lon; 28 //window.location = url; 26 loadNodeList(mousepos); 29 27 } 30 28 … … 34 32 map.addLayer(layerHeatmap); 35 33 36 layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2("All Access points", {isBaseLayer: false, visibility: false});34 layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2("All Access points", {isBaseLayer: false, visibility: true}); 37 35 map.addLayer(layerHeatmap2); 38 36 … … 48 46 } 49 47 50 function loadXMLDoc(mousepos) 51 { 52 var xmlhttp; 53 var txt,xx,x,i; 54 if (window.XMLHttpRequest) 55 {// code for IE7+, Firefox, Chrome, Opera, Safari 56 xmlhttp=new XMLHttpRequest(); 48 function loadNodeList(mousepos){ 49 var nodelist; 50 if (window.XMLHttpRequest){ 51 // code for IE7+, Firefox, Chrome, Opera, Safari 52 nodelist=new XMLHttpRequest(); 57 53 } 58 else 59 {// code for IE6, IE560 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");54 else{ 55 // code for IE6, IE5 56 nodelist=new ActiveXObject("Microsoft.XMLHTTP"); 61 57 } 62 58 63 64 xmlhttp.onreadystatechange=function() 65 { 66 if (xmlhttp.readyState==4 && xmlhttp.status==200) 67 { 68 txt=""; 69 x=xmlhttp.responseXML.documentElement.getElementsByTagName("CD"); 70 for (i=0;i<x.length;i++) 71 { 72 xx=x[i].getElementsByTagName("ARTIST"); 73 txt=txt + xx[0].firstChild.nodeValue + "<br>"; 74 } 75 document.getElementById('nodelist').innerHTML=txt; 59 nodelist.onreadystatechange=function(){ 60 if (nodelist.readyState==4 && nodelist.status==200){ 61 txt=eval("("+nodelist.responseText+")") 62 document.getElementById('nodelist').innerHTML=txt; 76 63 } 77 64 } 78 xmlhttp.open("POST","/static/test.xml",true); 79 //xmlhttp.open("POST","/website/lat=" + mousepos.lat + "&lon=" + mousepos.lon,true);80 xmlhttp.send();65 66 nodelist.open("GET","/website/nodelist/" + mousepos.lat + "," + mousepos.lon,true); 67 nodelist.send(); 81 68 } -
src/django_gheat/website/templates/home.html
r9175 r9177 17 17 <h1>Info</h1><br /> 18 18 Info 19 <div id="nodelist"><h2>Let AJAX change this text</h2></div> 20 <button type="button" onclick="loadXMLDoc()">Change Content</button> 19 <div id="nodelist"></div> 21 20 </div> 22 21 <div id="footer"> <a href="http://www.wirelessleiden.nl/">wirelessleiden.nl</a> </div> -
src/django_gheat/website/urls.py
r9147 r9177 19 19 ), 20 20 ) 21 22 urlpatterns += patterns('website.nodelist', 23 url( 24 regex = r'^nodelist/(?P<lat>[0-9.]+),(?P<lon>[0-9.]+)$', 25 view = 'serve_nodelist', 26 name = 'serve_nodelist', 27 ), 28 )
Note:
See TracChangeset
for help on using the changeset viewer.