Avatar of Ivan Golubar
Ivan Golubar

asked on 

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

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({
  url: '/wp-content/themes/net4/usersOnMainPageAjax.php',
  data:  {
      "actualproject": whichProjectToSave
   datatype: 'text',
    success: function(strdate){
  $('#usersWindowID > p').html(strdate);
     error: function(error, txtStatus) {

Open in new window

while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
echo $partners_username;
echo $partnersHTML;  

Open in new window

In general I need to learn how to get two variables with ajax from php.

Avatar of undefined
Last Comment
Ivan Golubar

8/22/2022 - Mon