title: How to get the value from a web api response
body: <p>I have a ASP.NET web application where I have a controller with an action that receives table vale and returns JSON for the client side grid binding. In this action I want to make a call to a WEB API, receive the response as JSON and use the JSON string to bind gridview.</p>
  
  <p>(And I'm  allowed to call the WEB API directly with JavaScript)</p>
  
  <p>I manage to make the request to the Web API but I can't figure out how to read out the JSON string.</p>
  
  <p>Here is my method:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
     function codeAddress() {
  
         var Drop = 'api/Task/dis';
         debugger;
  
         $.ajax({
             url: Drop,
             type: 'GET',
             data: JSON.stringify({}),
             contentType: "application/json; charset=utf-8",
             dataType: "json",                                    
                  success: function (data) {
                  debugger;
                  alert(data);
                  $('#gvbooksdetails tr:not(:first)').remove();
                      $('#gvbooksdetails').append("&lt;tr&gt;&lt;th&gt;AuthorName&lt;/th&gt;&lt;th&gt;Bookname &lt;/th&gt;&lt;th&gt;Booktype&lt;/th&gt;&lt;th&gt;Publisher&lt;/th&gt;&lt;/tr&gt;")
                  for (var i = 0; i &lt; data.d.length; i++) {
                     $('#gvbooksdetails').append("&lt;tr&gt;&lt;td&gt;" + data.d[i].AuthorName + "&lt;/td&gt;&lt;td&gt;" + data.d[i].BooName + "&lt;/td&gt;&lt;/tr&gt;" + data.d[i].BookType + "&lt;/td&gt;&lt;/tr&gt;" + data.d[i].Publication + "&lt;/td&gt;&lt;/tr&gt;")
                  };
             },
             error: function () {
                 alert("Error");
             }
         });
         return false;
      }
  </code></pre>
  
  <p>Below is the  controller code:</p>
  
  <pre><code> &lt;Route("api/Task/dis")&gt; _
      &lt;AcceptVerbs("GET", "PUT", "POST")&gt;
      Public Function dis() As IHttpActionResult
  
          Dim gsgrid = (From d2 In db1.demodisplay(0).AsQueryable() Select d2).CopyToDataTable
  
          If gsgrid Is Nothing Then
              Return NotFound()
          End If
  
          Return Ok(gsgrid)
  
      End Function
  </code></pre>
  
  <p>I am getting the values in gsgrid...but in the JavaScript in that alert I am getting object;object like this.
  How to assign the data sources to bind grid view?</p>