JavaScript retrieve php sql values for chartjs into jquery/ajax

Im trying to use http://www.chartjs.org/ to create a pie chart while retrieve database values. Following are my codes

callactiveinactive.php

<?php
require connectDB.php;

$sql = "SELECT Player_Status from player
WHERE Player_Status = 'Active' ";
$res = $conn->query($sql);
$active = $res->num_rows;

$sql = "SELECT Player_Status from player
WHERE Player_Status = 'Suspended' ";
$res = $conn->query($sql);
$suspended = $res->num_rows;

echo json_encode(array($active,$suspended));
?>

the main display page

 <canvas id="pieChart" style="height: 399px; width: 798px;" width="798"
> height="399"></canvas> 
><script> 
>$.ajax({       
>url:'callactiveinactive.php',
>      dataType: 'json'
> 
>      success:function(data){       
>var active = data["active"];        
>var suspended = data["suspended"];
>      } });
> 
>     var pieChartCanvas = $("#pieChart").get(0).getContext("2d");
>     var pieChart = new Chart(pieChartCanvas);
> 
> 
> 
>   
>     var PieData = [
>       {
>         value: var active,
>         color: "#f56954",
>         highlight: "#f56954",
>         label: "Active"
>       },
>       {
>         value: var suspended,
>         color: "#00a65a",
>         highlight: "#00a65a",
>         label: "Suspended"
>       },
> 
>     ];  pieChart.Doughnut(PieData, pieOptions); </script>

I know my .ajax there are messed up, please forgive me as I'm newbie on this.

Answer:1

i have tried to perform axios.delete operation in react, unfortunately it is not working, please help me to solve this issue, export function DeletePatient(token,deletePatient) { return axios....

i have tried to perform axios.delete operation in react, unfortunately it is not working, please help me to solve this issue, export function DeletePatient(token,deletePatient) { return axios....

  1. axios delete method not allowed
  2. axios delete method body
  3. axios delete method
  4. axios delete request method options
  5. laravel axios delete method not allowed
  6. axios delete 405 method not allowed
  7. axios js delete method

i get weather json from forecast.io and in json data forecast.io have timestamp : time:1445767494,"summary":"صافِ","icon":"clear-day","precipIntensity":0,"precipProbability":0,"temperature":32.99,"...

i get weather json from forecast.io and in json data forecast.io have timestamp : time:1445767494,"summary":"صافِ","icon":"clear-day","precipIntensity":0,"precipProbability":0,"temperature":32.99,"...

So I wanted to make a webpage in which on button click, the background color changes. Its showing TypeError on loading in browser but its working fine after pasting same JavaScript on console. Code ...

So I wanted to make a webpage in which on button click, the background color changes. Its showing TypeError on loading in browser but its working fine after pasting same JavaScript on console. Code ...

  1. typeerror button is null
  2. typeerror button is null learn more

When I click on the link << Add Call >> the modal is opened with custom URL but in the background is a blank view, I want the previous state to still appearing behind the modal when opened ...

When I click on the link << Add Call >> the modal is opened with custom URL but in the background is a blank view, I want the previous state to still appearing behind the modal when opened ...

  1. view previous state tax returns