javascript - Google chart enabled page not loading when uploaded to the server -
i uploaded following index.html file subdomain , isn't loading. shows title tag.
i want load when go xxx.myapp.com. setup ok on godaddy because see title, rest of page doesn't render. see network requests on server bit nothing...
any thoughts?
<!doctype html> <html> <head> <title>mi testing title</title> <!--load ajax api--> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript" src="http://www.myapp.com/js/helperfunctions.js"></script> <script type="text/javascript" src="http://www.myapp.com/js/settings.js"></script> <!-- zurb foundation--> <link type="text/css" rel="stylesheet" href="http://www.myapp.com/foundation-4.3.1/css/foundation.css" /> <link type="text/css" rel="stylesheet" href="http://www.myapp.com/foundation-4.3.1/css/foundation.min.css" /> <link type="text/css" rel="stylesheet" href="http://www.myapp.com/foundation-4.3.1/css/normalize.css" /> <!--local css --> <link type="text/css" rel="stylesheet" href="http://www.myapp.com/css/analyticsindex.css"/> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> // load visualization api , piechart package. google.load('visualization', '1.0', {'packages':['corechart']}); // set callback run when google visualization api loaded. google.setonloadcallback(drawcharts); /* called when library loaded */ function drawcharts(){ drawdailyaveragesessionlength(); drawusersgender(); } /* draws chart average session length day */ function drawdailyaveragesessionlength() { //apit data var api = get_avg_sessions_url+"2013/0/0"; //request data (using jquery/ajax) $.getjson(api,function(data){ //start days , seconds array var days = []; var seconds = []; //init google data array var googdata = new google.visualization.datatable(); //add x y columns googdata.addcolumn('string', 'days'); googdata.addcolumn('number', 'seconds'); //init sort array var sorted =[]; //parse results dates (var key in data){ var date = new date(key); sorted.push(date); } //sort array sorted.sort(sortdatearraydescending); //split results (i=0;i<sorted.length;i++){ //get date object var day = sorted[i]; //add 1 month var month = day.getmonth()+1; //parse string var newkey = day.getfullyear()+'-'+month+'-'+day.getdate(); var short = month+'/'+day.getdate(); //add date days array days.push(short); //add integer array seconds.push(parseint(data[newkey])); } //parse google data (i=0; i<days.length;i++){ googdata.addrow([days[i], seconds[i]]); } // set chart options var options = {'title':'average session length (not accurate since end of sessions aren\'t being tracked)', 'width':1200, 'height':400}; // instantiate , draw our chart, passing in options. var chart = new google.visualization.linechart(document.getelementbyid('averagesessionlengthchart')); chart.draw(googdata, options); }); } /* draws chart average session length day */ function drawusersgender() { //apit data var api = get_users_sex; //request data (using jquery/ajax) $.getjson(api,function(data){ //start days , seconds array var result = [['gender', 'number']]; //iterate on genders (var gender in data){ //get value pair , push var entry = [gender, parseint(data[gender])]; result.push(entry); } //parse google data var data = google.visualization.arraytodatatable(result); //display options var options = { title:'gender registered users', 'width':600, 'height':400 }; //draw chart var chart = new google.visualization.piechart(document.getelementbyid('genderchart')); chart.draw(data, options); }); } </script> </head> <body> <div class="row"> <div id = "averagesessionlengthchart" class="large-12 small-12 columns"> </div> </div> <div class="row"> <div id = "genderchart" class="large-12 small-12 columns"> </div> </div> </body> </html>
try developper console pc outside network see requests sent (press 'f12' on chrome or install firebug extension on firefox). there should "network" tab shows requests made page. maybe understand happening.
Comments
Post a Comment