title: jQuery, javascript array/object SQL injection issue
body: <p>Ive got a problem and i don't have any idea how to fix it. 
  Ive a module on my site that shows some data, it uses jquery dom and it creates some elements from a javascript array, witch contains javascript objects. 
  This array is generated with php and it gets the data from a postgres database.</p>
  
  <p>So if a user tries to inject the database the database stores the string as a normal entry, i have no problems with it.
  The problem appears when I want to list the content. But, only on client side. The listing is done, ive generated the string, i pass it to client side, the dom elements are created, but they have no content. Im using the php function addslashes() to escape the escapes, but i only get in trouble. </p>
  
  <p>So: here is the array  </p>
  
  <pre><code>[
      {"id": "26", "text": "RSS Feed collection"},
      {"id": "50", "text": "\\ \' "}
  ]
  </code></pre>
  
  <p>As you can see the last one contains the test injection  </p>
  
  <p><strong>edit</strong><br>
  HTML code:  </p>
  
  <pre><code> &lt;div class="item"&gt;
       &lt;span&gt;Text&lt;/span&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>This is generated using jQuery.</p>
  
  <p>JS part:</p>
  
  <pre><code>var myArray = [the upper array];
  var container = $("#container");
  
  for( nI=0, nC = myArray.length; nI&lt;nC; nI++) {
      var currentObj = myArray[nI];
      var newItem = $("&lt;div /&gt;").appendTo(container);
      $("&lt;span /&gt;").appendTo(item).html(currentObj.text);
  }
  </code></pre>
  
  <p>And the result is nothing visible, the array looks fine, but every place where normally the text should be is empty. The question is why?</p>