Changeset 16592
- Timestamp:
- 06/02/13 15:55:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/Module/calendar.php
r16591 r16592 97 97 <script type="text/javascript"> 98 98 99 function testData() 100 { 101 //calls the xml request in a loop based on the current sources 102 var source = ['Mrk 421','Mrk 501']; 103 for (i = 0; i<source.length; i++) 104 { 105 testXMLData(i, source); 106 } 107 } 108 109 function testXMLData(index, source) 110 { 111 var testXML; 112 testXML = new XMLHttpRequest(); 113 //NOTE: previous errors on the request was caused by appending "http://www.fact-project.org" 114 testXML.open("GET","/smartfact/index.php?source="+escape(source[index])+"&time="+year+"-"+month+"-"+day,true); 115 dataSource = new Array(); 116 testXML.onload=function() { 117 if (testXML.status==200) 118 { 119 line=testXML.responseText.split('\n'); 120 dataSource.push(line); 121 if (dataSource.length == source.length) 122 { 123 displayXMLData(dataSource, source); //this will be called when the last data from the list is read 124 } 125 } 126 testXML.send(); 127 } 128 129 function displayXMLData(dataSource, source) 130 { 131 //This function splits the lines of data per data source 132 var dataGraph = new Array(source.length); 133 for (i=0; i<source.length; i++) 134 { 135 dataGraph[i] = new Array(); //dataGraph contains the individual points for each source i 136 for(row=0;row<dataSource[i].length;row++) 137 { 138 rows=line[row].split(','); 139 dataGraph[i].push(rows[4]); 140 $('#data').append(i + ' GRAPH DATA ' + dataGraph[i]); 141 } 142 } 143 } 99 144 100 145 CAL.addEventListener("onSelect", function(){
Note:
See TracChangeset
for help on using the changeset viewer.