title: Ajax call is returning [object Object]
body: <p><strong>Html</strong>   </p>
  
  <pre><code>&lt;div&gt;
      &lt;select id="method"&gt;
          &lt;option value="get"&gt;GET&lt;/option&gt;
          &lt;option value="post"&gt;POST&lt;/option&gt;
          &lt;option value="put"&gt;PUT&lt;/option&gt;
      &lt;/select&gt;
      &lt;input type="button" value="Try it" onclick="sendRequest()" /&gt;
      &lt;span id='value1'&gt;(Result)&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Jquery</strong></p>
  
  <pre><code>@section scripts {
      &lt;script&gt;
          // TODO: Replace with the URL of your WebService app
          var serviceUrl = 'http://localhost:99999/api/books';
  
          function sendRequest() {
              var method = $('#method').val();
  
              $.ajax({
                  type: method,
                  url: serviceUrl,
                  dataType: 'json',
                  success: function (data) {
                      $('#value1').text(data);
                      console.log(data);
                  },
                  error: function (jqXHR, textStatus, errorThrown) {
                      $('#value1').text(jqXHR.responseText || textStatus);
                  }
              });
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>The <code>success</code> function is showing up with arrays of [object, Object]. The console shows the data for each object, but it is not showing on the page. </p>
  
  <p>For each book, I have to list the Id, Title, and the Author.</p>
  
  <pre><code>public IHttpActionResult Get()
          {
              IQueryable&lt;BookDTO&gt; books;
              books = from b in db.Books
                      select new BookDTO()
                      {
                          Id = b.Id,
                          Title = b.Title,
                          AuthorName = b.Author.Name
                      };
              return Ok(books);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/cLzzq.png" rel="nofollow noreferrer">console.log Output</a></p>