title: how Get MVC Json Result and populate in a Table using Ajax
body: <p>I need an idea on how I can GET my MVC Json result and populate it inside my view table using Ajax,</p>
  
  <p>this is my json result</p>
  
  <pre><code>public JsonResult GetAllContacts()
      {
  
          var User = GetLoggedInUserID();
  
          var getContact = _contactService.GetUserContacts(User).Select(x =&gt; new
          {
              Id = x.Id,
              Name = x.Name,
              MobileNumber = x.MobileNumber
          });
  
          return Json(getContact, JsonRequestBehavior.AllowGet);
  
      }
  </code></pre>
  
  <p>Please how can I archieve this?</p>
  
  <p>Secondly My Table has Checkboxs that I will be able to pick the Mobile number and populate them inside a Listbox</p>
  
  <p>this is my table view</p>
  
  <pre><code>&lt;table class="table table-striped table-hover table-bordered" id="contacts"&gt;
                              &lt;thead&gt;
                                  &lt;tr&gt;
                                      &lt;th&gt;&lt;input type="checkbox" name="chooseAllRecipient" id="chooseAllRecipient" /&gt;&lt;/th&gt;
                                      &lt;th class="center"&gt;Contact Name(s)&lt;/th&gt;
                                      &lt;th class="center"&gt;Mobile Number(s)&lt;/th&gt;
                                  &lt;/tr&gt;
                              &lt;/thead&gt;
  
                              &lt;tbody&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;&lt;input type="checkbox" name="chooseRecipient" class="my_chkBox"&gt;&lt;/td&gt;
                                      &lt;td&gt;&lt;/td&gt;
                                      &lt;td&gt;&lt;/td&gt;
                                  &lt;/tr&gt;
                              &lt;/tbody&gt;
                          &lt;/table&gt;
  </code></pre>
  
  <p>and this is my Script</p>
  
  <pre><code>function GetContact() {
  
  $.ajax({
      url: table.data('/Contact/GetAllContacts'),
      type: 'GET',
      contentType: 'application/json',
      data: JSON.stringify(),
      cache: false,
      context: table,
      success: function (contact) {
          var tableBody = this.find('tbody');
          tableBody.empty();
          $.each(contact, function (index, contact) {
              $('&lt;tr/&gt;', {
                  html: $('&lt;td/&gt;', {
                      html: contact.Name
                  }).after($('&lt;td/&gt;', {
                      html: contact.MobileNumber
                  }))
              }).appendTo(tableBody);
          });
      },
      error: function () { alert("error"); }
  });
  </code></pre>
  
  <p>}</p>
  
  <p>$('#getContacts').click(function () {</p>
  
  <pre><code>GetContact();
  </code></pre>
  
  <p>});</p>
  
  <p>please I need some help on how to get this working with jQuery and AJAX because I can't figure out were the problem is coming form please thank you very mush...</p>