title: Manipulating the "data" from $.ajax success: function(data) {
body: <p>i have this and a simple question to it.</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "/",
      data: $(".form").serialize(),
      dataType: "html",
      success: function (data) {
          $("#id").html(data);
      }
  });
  </code></pre>
  
  <p>Inside "data" is some html I am inserting into the DOM. Thats no problem. But I want to manipulate the "data" before doing so. How can I do that? For example there are some li elements in "data". How would I for example delete the last li element out of the "data" string before inserting it into the DOM?</p>
  
  <p>I tried something like </p>
  
  <pre><code>$(data li:last)remove();
  </code></pre>
  
  <p>...but that didnt work.</p>
  
  <p>Thanks for your help.</p>