Project

General

Profile

1 27204 antonis.le
2
3
function getData(table,dimensions,measures,aggr){
4
	var ajaxRequest;  // The variable that makes Ajax possible!
5
6
	try{
7
		// Opera 8.0+, Firefox, Safari
8
		ajaxRequest = new XMLHttpRequest();
9
	} catch (e){
10
		// Internet Explorer Browsers
11
		try{
12
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
13
		} catch (e) {
14
			try{
15
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
16
			} catch (e){
17
				// Something went wrong
18
				alert("Your browser broke!");
19
				return false;
20
			}
21
		}
22
	}
23
	// Create a function that will receive data sent from the server
24
	ajaxRequest.onreadystatechange = function(){
25
		if(ajaxRequest.readyState == 4){
26
			var mydata = null;
27
			mydata = JSON.parse(ajaxRequest.responseText);
28
			renderTable(mydata);
29
		}
30
	}
31
	//var infotype = document.getElementById('infotype').value;
32
	var queryString = '';
33
	for(var i = 0; i < dimensions.length; i++){
34
		if(i!=0)
35
			queryString += ';';
36
		queryString += dimensions[i];
37
	}
38
	queryString += "&measures=";
39
	for(var i=0; i< measures.length; i++) {
40
		if(i!=0)
41
			queryString += ';';
42
		queryString += measures[i];
43
	}
44
	queryString = '?com=read&aggregation='+aggr+'&facttable='+table+'&dimensions='+queryString;
45
46
	ajaxRequest.open("GET", "ajaxRouter.php"+queryString, true);
47
	ajaxRequest.send(null);
48
}
49
50
51
52
53
//ajax function for each time a new measurement is selected
54
function ajaxgetMeasurement(table,value,xAxis){
55
	var ajaxRequest;  // The variable that makes Ajax possible!
56
57
	try{
58
		// Opera 8.0+, Firefox, Safari
59
		ajaxRequest = new XMLHttpRequest();
60
	} catch (e){
61
		// Internet Explorer Browsers
62
		try{
63
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
64
		} catch (e) {
65
			try{
66
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
67
			} catch (e){
68
				// Something went wrong
69
				alert("Your browser broke!");
70
				return false;
71
			}
72
		}
73
	}
74
	// Create a function that will receive data sent from the server
75
	ajaxRequest.onreadystatechange = function(){
76
		if(ajaxRequest.readyState == 4){
77
			var mydata = JSON.parse(ajaxRequest.responseText);
78
79
			renderChart(mydata);
80
		}
81
	}
82
	//var infotype = document.getElementById('infotype').value;
83
	var queryString = "?table=" + table + "&x=" + xAxis + "&y=" + "myseries" + "&measurement=" + value;
84
	ajaxRequest.open("GET", "test.php" + queryString, true);
85
	ajaxRequest.send(null);
86
}