title: $.parseJSON Unexpected Character
body: <p>I'm trying to send data from an html <code>data</code> attribute on a <code>span</code> element and receive it with Ajax and then process it with php and mysql and return the new value to my data attribute in html, but I'm getting a error that says "$.parseJSON unexpected character", can someone please look over my code to see if I'm processing the data correctly as I'm new to working with JSON.</p>
  
  <p><strong>HTML / PHP</strong></p>
  
  <pre><code>&lt;span data-object=
  '{"art_id":"&lt;?php echo $row['art_id'];?&gt;",
  "art_featured":"&lt;?php echo $row['art_featured'];?&gt;"}' 
  class="icon-small star-color"&gt;&lt;/span&gt;
  &lt;!-- art_id and art_featured are both int and art_featured will be either 1 or 0 --&gt;
  </code></pre>
  
  <p><strong>jQuery / Ajax</strong></p>
  
  <pre><code>$("span[class*='star']").on('click', function () {
      var data = $.parseJSON($(this).data('object'));
      var $this = $(this);
  
      $.ajax({
          type: "POST",
          url : "ajax-feature.php",
          data: {art_id: data.art_id,art_featured: data.art_featured}
      }).done(function(result) {
          data.art_featured = result;
          $this.data('object', JSON.stringify( data ));
      });
  
  });
  </code></pre>
  
  <p><strong>PHP / mySQL</strong></p>
  
  <pre><code>if($_POST['art_featured']==1) {
          $sql_articles = "UPDATE `app_articles` SET `art_featured` = 0 WHERE `art_id` =".$_POST['art_id'];
  
          $result = array('art_id' =&gt; $_POST['art_id'], 'art_featured' =&gt; 0);
          echo json_encode($result);
      }
      else if($_POST['art_featured']==0){
          $sql_articles = "UPDATE `app_articles` SET `art_featured` = 1 WHERE `art_id` =".$_POST['art_id'];
  
          $result = array('art_id' =&gt; $_POST['art_id'], 'art_featured' =&gt; 1);
          echo json_encode($result);
      }
  
      if(query($sql_articles)) {
  
      }
      else {
  
      }
  </code></pre>