title: Passing multiple variables through json_encode
body: <p>I'm kinda making a mess now with my code, usually I'd make a PHP-AJAX script and pass one variable back to the JS script with json_encode. This time I would like to pass a few variables with json_encode, unfortunately I don't know how to separate the value in JS.</p>
  
  <p><strong>My JS code:</strong></p>
  
  <pre><code>$('#submit').click(function(){
  
      // Storing the value into variables
      var content_page = $('#content-page').val();
      var content_url = 'action=saving&amp;page='+content_page;
  
          // Starting the AJAX post form
          $.ajax({
                  type: 'POST',
                  url: 'handlers/content.handler.php',
                  data: content_url,
                  success: function(responseText)
                  {
                      $.parseJSON(responseText); // Making the return value of the PHP handler reedable
  
                      alert(responseText.pageid)
  
                          if(responseText.indexOf(1) &gt; -1)
                          {
                              noty({ text: 'U heeft geen pagina gekozen om te bewerken!' });
                          }
                          else if(responseText.indexOf(2) &gt; -1)
                          {
                              noty({ text: 'U heeft geen geldige pagina gekozen!' }); 
                          }
                          else if(reponseText.indexOf(100) &gt; -1)
                          {
                              noty({ text: 'Pagina is opgehaald' });
                          }
                  }
              });
      return false;
  });
  </code></pre>
  
  <p><strong>My PHP code:</strong></p>
  
  <pre><code>&lt;?php
  /* Dit bestand handeld gegevens af voor het bestand content in de map panel. Gegevens komen hier door heen via een JS bestand(content.handler.js...) en worden ook weer terug gestuurd. */
  include_once '../includes/config.php';
  
      // Controleren of server contact maakt en geen persoon.
      if(isset($_POST['action']) &amp;&amp; $_POST['action'] == 'saving')
      {
          $stringPage = trim($_POST['page']);
          $error = array();
          $bolean = false;
  
              # Prepared statement.
              $stmt = $mysqli-&gt;prepare('SELECT id,name,title,text FROM pages WHERE name = ?');
              $stmt-&gt;bind_param('s', $stringPage);
              $stmt-&gt;execute();
              $stmt-&gt;store_result();
              $stmt-&gt;bind_result($pageID, $pageName, $pageTitle, $pageText);
              $stmt-&gt;fetch();
              $intPage = $stmt-&gt;num_rows();
              $stmt-&gt;close();
  
      /* Controle */
          if(empty($stringPage))
          {
              $error[] = 1;
              $bolean = true;
          }
          if($intPage == 0)
          {
              $error[] = 2;
              $bolean = true;
          }
  
              if($bolean == false)
              {
                  $error[] = 100;
  
              }
  
  
              header('Content-Type: application/json');
              $array = array($error, $pageID, $pageName, $pageTitle, $pageText);
              echo json_encode($array, JSON_FORCE_OBJECT);
      }
  ?&gt;
  </code></pre>
  
  <p>So all the value is coming back just fine, so there's no problem with that. My problem is that I put everything that I wanted in an array(not the best solution) and don't know how to separate in JS. I suggest it would be something like response.pageid but that didn't work.</p>