diff --git a/download.html b/download.html index bd536c9..b9fda59 100644 --- a/download.html +++ b/download.html @@ -7,7 +7,6 @@
@@ -145,19 +143,37 @@ } } + /* oRequest = new XMLHttpRequest(); var sURL = "http://8b51d1abd8.test-url.ws/gzipsize.php?encode="+mincss; oRequest.open("GET",sURL,false); oRequest.send(null); + */ + //Old XHR stuff above - + var url = "http://8b51d1abd8.test-url.ws/gzipsize.php"; + var params = "?encode="+mincss; + http.open("POST", url, true); - document.getElementById('details').innerHTML = "Your download of min is " + details.total + " bytes unminified, " + details.totalmin + " bytes minified (above), and " + details.totalmingzip + " bytes minified and gzipped." + //Send the proper header information along with the request + http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + http.setRequestHeader("Content-length", params.length); + http.setRequestHeader("Connection", "close"); - //details.totalmingzip = parseInt(oRequest.responseText); + http.onreadystatechange = function() { + //Call a function when the state changes. + if (http.readyState == 4 && http.status == 200) { + alert(http.responseText); + details.totalmingzip = parseInt(http.responseText) + document.getElementById('details').innerHTML = document.getElementById('details').innerHTML.replace(' and', ','); + document.getElementById('details').innerHTML += ", and " + details.totalmingzip + " bytes minified and gzipped." + mixpanel.track('Calculate CSS', details); + } + } + http.send(params); - mixpanel.track('Calculate CSS', details); + document.getElementById('details').innerHTML = "Your download of min is " + details.total + " bytes unminified and " + details.totalmin + " bytes minified (above)"; console.log(details); return mincss;