title: Ajax - variables are seen in chrome network tab but they don't seem to pass to the PHP function
body: <p>I am trying to update a php function using ajax.
  I Have an array stored in localstorage. 
  The array contains values of clicked  id's.</p>
  
  <p>When I click the <code>&lt;tr&gt;</code>, the array gets updated and sent via ajax from a js file to the php file. </p>
  
  <p>js file </p>
  
  <pre><code>function storeId(id) {
      var ids = JSON.parse(localStorage.getItem('reportArray')) || [];
  
      if (ids.indexOf(id) === -1) {
          ids.push(id);
          localStorage.setItem('reportArray', JSON.stringify(ids));
      }else{
          //remove id from array
          var index = ids.indexOf(id);
          if (index &gt; -1) {
              ids.splice(index, 1);
          }
          localStorage.setItem('reportArray', JSON.stringify(ids));
      }
      return id;
  }
  
  //ajax function
  $('table tr').click(function(){
          var id = $(this).attr('id');
          storeId(id);
          var selected_lp = localStorage.getItem('reportArray');
          console.log(selected_lp);
  
          var query = 'selected_lp=' + selected_lp;
          $.ajax({
                  type: "POST",
                  url: "../inc/updatelponadvdash.php",
                  data: { selected_lparr : selected_lp},
                  cache: false,
                  success: function(data) {
  
                      return true;
                  }
              });
  
      });
  </code></pre>
  
  <p>updatelponadvdash.php file</p>
  
  <pre><code>&lt;?php
  require_once 'inc.php';
  
  $selected_lparr = json_decode($_POST['selected_lparr']);
  
     foreach($selected_lparr as $value){
  
        $dbData = $lploop-&gt;adv_lploops($value); 
     }
  ?&gt;
  </code></pre>
  
  <p>Now, in the chrome network tab, when I click the  and I <code>dump_var($selected_lparr)</code> the array is updated and I see the values like this:<a href="https://i.stack.imgur.com/KB9Dd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KB9Dd.png" alt="enter image description here"></a></p>
  
  <p>For some reason I get a 500 error.
  As well I dont understand why the var_dump(inside the function below) dosent work. I seems that the function <code>adv_lploops</code> dosent get the variables. but i dont understand why.</p>
  
  <p>This is the fuction I call:</p>
  
  <pre><code>public function adv_lploops($value){
      $sql = "SELECT * FROM `lptitels` WHERE titleidNo = '$value'";
      $row = $sql-&gt;fetch(PDO::FETCH_ASSOC);
      var_dump($row);
  }
  </code></pre>