Welcome Guest, Not a member yet? Register   Sign In
debugging javascript in a view
#5

(This post was last modified: 01-19-2018, 07:49 PM by richb201.)

Yes. I can see that. What I did was copied the example of passing in a json string and displaying it EXACTLY as it appears in the docs. I even used a datafile of their suggestion. It still doesn't work. This the view I am using

google.charts.load('current', {packages:['corechart']});
google.charts.setOnLoadCallback(drawChart);

   function drawChart() {
       var jsonData = $.ajax({
           url: "Configure.php",
           dataType: "json",
           async: false
       }).responseText;

       var data = new google.visualization.DataTable(jsonData);

       // Create the chart.
       // Instantiate and draw our chart, passing in some options
       var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
       // Draw the chart, setting the allowHtml option to true for the tooltips.
       chart.draw(data, {allowHtml: true});
   }

 I see that this line is failing:

google.charts.load('current', {packages:['corechart']}) with

"Failed to load resource: the server responded with a status of 404 (Not Found)"

So I think what is happening is that my  <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> is failing with a 404 being returned. However I loaded up a packet sniffer and this is what it sees as the request/response

Request HeadersFull URL: https://www.gstatic.com/charts/loader.js
User-Agent : Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
X-DevTools-Emulate-Network-Conditions-Client-Id : (9FB18167E5F642CED6651B041C837001)
X-Chrome-UMA-Enabled : 1
X-Client-Data : CKO1yQEIkLbJAQiitskBCMS2yQEI+pzKAQipncoBCKijygE=
Accept : */*
Referer : http://localhost/index.php/Configure/org...management
Accept-Encoding : gzip, deflate, br
Accept-Language : en-US,en;q=0.9


Response HeadersFull URL: https://www.gstatic.com/charts/loader.js
status : 200
accept-ranges : bytes
vary : Accept-Encoding, Origin
content-encoding : gzip
content-type : text/javascript
content-length : 33977
date : Sat, 20 Jan 2018 02:33:39 GMT
expires : Sat, 20 Jan 2018 03:33:39 GMT
last-modified : Wed, 20 Sep 2017 16:00:41 GMT
x-content-type-options : nosniff
server : sffe
x-xss-protection : 1; mode=block
cache-control : public, max-age=3600
age : 444
alt-svc : hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"


I wonder if the slow response speed is causing things to get out of sync? It seems I am trying to reload this script every time I display the view? 
proof that an old dog can learn new tricks
Reply


Messages In This Thread
debugging javascript in a view - by richb201 - 01-19-2018, 02:25 AM
RE: debugging javascript in a view - by jreklund - 01-19-2018, 03:28 AM
RE: debugging javascript in a view - by richb201 - 01-19-2018, 06:22 AM
RE: debugging javascript in a view - by jreklund - 01-19-2018, 06:48 AM
RE: debugging javascript in a view - by richb201 - 01-19-2018, 06:35 PM
RE: debugging javascript in a view - by jreklund - 01-20-2018, 06:20 AM
RE: debugging javascript in a view - by richb201 - 01-20-2018, 09:10 AM
RE: debugging javascript in a view - by jreklund - 01-20-2018, 01:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB