Ignore:
Timestamp:
Jun 7, 2011, 12:43:21 PM (14 years ago)
Author:
dennisw
Message:

Switching to jquery.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/django_gheat/website/static/heatmap_extensions_test.js

    r9233 r9234  
    3333// Uses zoomlevel en mouseposition to call the nodelist.py view. View returns nodes in json format which is read and printed in document element.
    3434function getNodeList(zoomlevel, mousepos) {
    35   var url = "/website/nodelist/" + zoomlevel + "," + mousepos.lat + "," + mousepos.lon;
    36   var ajax = new AjaxRequest(url, setNodeList);
    37   ajax.doGet();
    38 }
    39 
    40 
    41 function setNodeList(responseText) {
    42   json_nodelist=eval('(' + responseText + ')');
    43   if (json_nodelist.length>0){
    44     list = 'Wireless Leiden nodes on mouseposition:<br /><b>';
    45     for (var i=0; i<json_nodelist.length; i++){
    46       list += json_nodelist[i].fields.ssid + '<br />';
     35  $.getJSON("/website/nodelist/" + zoomlevel + "," + mousepos.lat + "," + mousepos.lon,
     36    function(json) {
     37      content = 'Wireless Leiden nodes on mouseposition:<br /><b>';
     38      $.each(json, function(i,json){
     39        content += json.fields.ssid;
     40      });
     41      content += '</br>';
     42      $("#node_list").html(content);
    4743    }
    48     list += '</b>';
    49   }
    50   else{
    51     list = 'No nodes to display.';
    52   }
    53   document.getElementById('node_list').innerHTML=list;
     44  );
    5445}
    5546
Note: See TracChangeset for help on using the changeset viewer.