title: send json object from javascript to php
body: <p>I am trying to send JSON object from Javascript/Jquery to PHP and I am getting and error msg in my console. What am I doing wrong. I am new to JS and PHP.</p>
  
  <p><strong>JQuery file:</strong></p>
  
  <pre><code>$(document).ready(function() {
      var flickr = {'action': 'Flickr', 'get':'getPublicPhotos'};
      // console.log(typeof(flickr));
      var makeFlickrCall = function(flickrObj){
          $.ajax({
              url: '../phpincl/apiConnect.php',
              type: 'POST',
              data: flickrObj
          })
          .done(function(data) {
              console.log("success");
              console.log(JSON.stringify(data));
          })
          .fail(function() {
              console.log("error");
          })
          .always(function() {
              console.log("complete");
          });
      };
  
      makeFlickrCall(flickr);
  });
  </code></pre>
  
  <p><strong>PHP file</strong></p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php       
      $obj = $_POST['data'];
      // print_r($obj);
      return $obj;
  ?&gt;
  </code></pre>