Ok, add this line after the AJAX call: console.log(json);
reload the page and check the developer's console again. Post the output from that console.log call here. On Monday, June 16, 2014 4:56:29 PM UTC-4, Vincenzo Diligente Tizzani wrote: > > in firefox this messages > SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. > Use //# instead jquery.min.js:1 > Error: http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js > is being assigned a //# sourceMappingURL, but already has one > > in chrome nothing > > > Il giorno lunedì 16 giugno 2014 22:28:05 UTC+2, Andrew Gallant ha scritto: >> >> Open the page in Chrome and check the developer's console (ctrl+shift+j >> to open from Windows). Are there any error messages? >> >> On Monday, June 16, 2014 3:46:37 PM UTC-4, Vincenzo Diligente Tizzani >> wrote: >>> >>> My Ajax call is similar but not display graph >>> >>> thank you for all >>> >>> Il giorno lunedì 16 giugno 2014 20:10:18 UTC+2, Andrew Gallant ha >>> scritto: >>>> >>>> Your AJAX call should look something like this: >>>> >>>> var json = $.ajax({ >>>> url: "prova.php", >>>> data: { >>>> q: parameter, >>>> p: system >>>> }, >>>> dataType:"json", >>>> async: false >>>> }).responseText; >>>> >>>> On a side note, I suggest reworking your SQL query, as it is vulnerable >>>> to SQL injection attacks (see the Little Bobby Tables >>>> <http://bobby-tables.com/> problem). The PHP mysql* functions are >>>> considered unsafe, you should use the mysqli >>>> <http://www.php.net//manual/en/book.mysqli.php> or PDO >>>> <http://www.php.net//manual/en/class.pdo.php> objects for database >>>> access, both of which support parameter binding in queries to help stop >>>> one >>>> source of SQL injection in your query ($componente). You can't use >>>> parameter binding for $parametro in your query, so you either have to >>>> sanitize the input thoroughly to make sure a malicious user can't sneak an >>>> attack past you (hard to do) or use the user input to select from a >>>> known-good list of values for $parametro, eg: >>>> >>>> $q = strtolower($_GET["q"]); >>>> $parametroList = array('foo' => 'FOO', 'bar' => 'BAR', 'cad' => 'CAD'); >>>> $parametro = $parametroList[$q]; >>>> if ($parametro == null) { >>>> // throw an error >>>> } >>>> >>>> On Monday, June 16, 2014 4:32:40 AM UTC-4, Vincenzo Diligente Tizzani >>>> wrote: >>>>> >>>>> this is my file prova.php that is file called by Ajax: >>>>> <?php >>>>> $q=$_GET["q"]; >>>>> $p=$_GET["p"]; >>>>> $parametro=$q; >>>>> $componente=$p; >>>>> >>>>> $con = mysql_connect('localhost', 'root') or die('Error connecting to >>>>> server'); >>>>> >>>>> mysql_select_db('effect_db',$con) or die ('Selezione Database non >>>>> riuscita'); >>>>> >>>>> $query = mysql_query('Select '.$parametro.',count('.$parametro.')as >>>>> Numero From detectedfaults where subsystemname="'.$componente.'" group >>>>> by >>>>> '.$parametro.' ')or die("Query fallita"); >>>>> $table = array(); >>>>> $table['cols'] = array( >>>>> >>>>> array('label' => $parametro, 'type' => 'string'), >>>>> array('label'=> 'Numero','type'=>'number'), >>>>> >>>>> ); >>>>> $rows= array(); >>>>> while($r = mysql_fetch_assoc($query)) { >>>>> $temp = array(); >>>>> // each column needs to have data inserted via the $temp array >>>>> >>>>> $temp[] = array('v' => $r[$parametro]); >>>>> $temp[] = array('v' => (int) $r['Numero']); >>>>> $rows[]= array('c' =>$temp); >>>>> } >>>>> >>>>> $table['rows'] = $rows; >>>>> >>>>> // populate the table with rows of data >>>>> >>>>> $jsonTable = json_encode($table); >>>>> >>>>> // encode the table as JSON >>>>> >>>>> //set up header; first two prevent IE from caching queries >>>>> header('Cache-Control: no-cache, must-revalidate'); >>>>> header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); >>>>> header('Content-type: application/json'); >>>>> >>>>> // return the JSON data >>>>> >>>>> echo $jsonTable; >>>>> >>>>> ?> >>>>> >>>>> and this example is json retuned hand setting $componente and >>>>> $parametro in prova.php >>>>> >>>>> {"cols":[{"label":"Severity","type":"string"},{"label":"Numero","type":"number"}],"rows":[{"c":[{"v":"block"},{"v":9}]},{"c":[{"v":"feature"},{"v":10}]},{"c":[{"v":"major"},{"v":152}]},{"c":[{"v":"minor"},{"v":13}]},{"c":[{"v":"text"},{"v":17}]},{"c":[{"v":"tweak"},{"v":5}]}]} >>>>> >>>>> >>>>> >>>>> >>>>> Il giorno sabato 14 giugno 2014 19:50:33 UTC+2, Andrew Gallant ha >>>>> scritto: >>>>>> >>>>>> If you can post an example of the data returned by your AJAX call, I >>>>>> will take a look and see if I can figure out what is wrong. >>>>>> >>>>>> On Saturday, June 14, 2014 4:12:25 AM UTC-4, Vincenzo Diligente >>>>>> Tizzani wrote: >>>>>>> >>>>>>> Thank you for help,but in this way not display graph. >>>>>>> Have you same idea to solving this problem?? >>>>>>> Thank you very much >>>>>> >>>>>> -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/d/optout.
