troubleshooting Question

php to jQuery

Avatar of designaire
designaireFlag for United States of America asked on
PHPjQuery
17 Comments1 Solution181 ViewsLast Modified:
How do I get this data from php to a jquery file so I can use it in a chart? The php has to be on another page because I have something else on there that I eventually need to use for the query. I have everything working separately but now have to integrate them. I'm very new to all coding languages.
data.php
	$query = "SELECT * FROM tracking where userid=1";		
	$result = mysqli_query($connection, $query);

	while($row = mysqli_fetch_array($result)) {
			$mind[] = $row['mind'];
			$body[] = $row['body'];
			$soul[] = $row['soul'];
			}

$mindData = implode(",", $mind);
$bodyData = implode(",", $body);
$soulData = implode(",", $soul);



  <script id="source" language="javascript" type="text/javascript">
$.ajax({                                      
  url: 'data.php', data: "", dataType: 'json',  success: function(rows)        
  {
???
    for (var i in rows)
    {
      var row = rows[i];          

      var mind = ??
      var body = ??
      var soul = ??

  </script>
  <script id="source" language="javascript" type="text/javascript">

so I can use it in a chart...

                name: 'Mind',
                type: 'spline',
                data: [mind],
                tooltip: {
                    valueSuffix: '0'
                },
				
				        }, {
                name: 'Body',
                type: 'spline',
                data: [body],
                tooltip: {
                    valueSuffix: '0'
                },
							
							        }, {
                name: 'Soul',
                type: 'spline',
                data: [soul],
                tooltip: {
                    valueSuffix: '0'
                },
  </script>
ASKER CERTIFIED SOLUTION
designaire

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 17 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros