title: Ajax MySQL POST responses with Object without data
body: <p>I am using that code to send a POST request to add data to a mysql table.</p>
  
  <pre><code>var todoItem = $(this).serialize();
  
    $.ajax({
      type: "POST",
      url: "/test",
      data: todoItem,
      dataType: "json",
      success: function(data, textStatus, jqXHR) {
        console.log(data);
        if(data.success){
          $('#todo-list').append(
            '&lt;li class="list-group-item"&gt;' +
              '&lt;span class="lead"&gt;' +
                data.todo +
              '&lt;/span&gt;' +
              '&lt;div class="pull-right"&gt;' +
                '&lt;a href="/test/#/edit" class="btn btn-sm btn-warning"&gt;Edit&lt;/a&gt;' +
                '&lt;form style="display: inline" method="POST" action="/test/${data.id}"&gt;' +
                  '&lt;button type="submit" class="btn btn-sm btn-danger"&gt;Delete&lt;/button&gt;' +
                '&lt;/form&gt;' +
              '&lt;/div&gt;' +
              '&lt;div class="clearfix"&gt;&lt;/div&gt;' +
            '&lt;/li&gt;'
          );
        } else {
          $("#todo-list").append(
            '&lt;li class="list-group-item"&gt;' +
              '&lt;span class="lead"&gt;' +
                'Fail' +
              '&lt;/span&gt;' +
              '&lt;div class="clearfix"&gt;&lt;/div&gt;' +
            '&lt;/li&gt;'
          );
        }
      }
  </code></pre>
  
  <p>Then i want to use data from the response to append to my list.
  But if(data.success) isnt passing. why is that?</p>
  
  <p>Also my data in console.log looks like object Object and doesnt contain the inserted row data.</p>
  
  <p>Do i need to send a get request now to retrieve the last data row?</p>