troubleshooting Question

Processing of multiple variables echoed from php, as java scrip variables.

Avatar of Ivan Golubar
Ivan Golubar asked on
PHPAJAXjQueryMySQL Server
4 Comments2 Solutions200 ViewsLast Modified:
I attached illustration there is result of  code snippets below: string with user names (ivan4joni) and two users avatars .
I have two users : ivan4 and joni. As I have a while loop in php, I get names together as one string.

What would be the code for ajax to get a javascript variable as array [ ivan4 , joni]?
I don't need  users to be displayed as array on main page but as a array which will be then used in js functions.

  $.ajas x({
  method:"POST",
  url: '/wp-content/themes/net4/usersOnMainPageAjax.php',
  data:  {
      "querry2":1,
      "actualproject": whichProjectToSave
   },
   datatype: 'text',
    success: function(strdate){
   
  $('#usersWindowID > p').html(strdate);
     },
     error: function(error, txtStatus) {
      console.log(txtStatus);
      console.log('error');
    }
  });  

<?php
while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
$partners_username=...............;
$partnersHTML=...............; 
echo $partners_username;
}
echo $partnersHTML;  
?>

In general I need to learn how to get two variables with ajax from php.
partners.png
ASKER CERTIFIED SOLUTION
Ivan Golubar

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

Join our community to see this answer!
Unlock 2 Answers and 4 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 2 Answers and 4 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