title: Fill Popup modal with data ASP.NET CORE MVC Jquery
body: <p>I try to make popup windows modal on <code>&lt;a&gt; link</code> and fill the modal with data from the controller.
  I test my function and everything works fine, so data is coming to my view and I get all data that I need.</p>
  <pre><code>{&quot;data&quot;:[{&quot;id&quot;:45,&quot;description&quot;:&quot;asddadasd&quot;,&quot;dateAndTime&quot;:&quot;09/03/2021 09:09&quot;,&quot;answered&quot;:&quot;0001-01-01T00:00:00&quot;,&quot;ticketTypeID&quot;:2,&quot;ticketType&quot;:null,&quot;userId&quot;:&quot;de31ed54-1f0c-4ca1-aea1-6b5eb40c813c&quot;,&quot;applicationUser&quot;:{&quot;name&quot;:&quot;Johnos Smith&quot;,&quot;streetAddress&quot;:&quot;Neka Tamo&quot;,&quot;city&quot;:&quot;Levanda&quot;,&quot;postalCode&quot;:&quot;710000&quot;,&quot;clientId&quot;:null,&quot;client&quot;:null,&quot;role&quot;:null,&quot;roleList&quot;:null,&quot;clientList&quot;:null,&quot;id&quot;:&quot;de31ed54-1f0c-4ca1-aea1-6b5eb40c813c&quot;,&quot;userName&quot;:&quot;email@gmail.com&quot;,&quot;normalizedUserName&quot;:&quot;email@gmail.com&quot;,&quot;email&quot;:&quot;email@gmail.com&quot;,&quot;normalizedEmail&quot;:&quot;email@gmail.com&quot;,&quot;emailConfirmed&quot;:false,&quot;passwordHash&quot;:&quot;AQAAAAEAACcQAAAAELNpgOfeZgcXCppwc3ccXbfSMu/o3CPf8grZwufVddWf/QtLzRFSCOvh/OWwkDKQww==&quot;,&quot;securityStamp&quot;:&quot;CYXEQMHODLAJO7UPYGDRZJ52WLBTVEKR&quot;,&quot;concurrencyStamp&quot;:&quot;17fc92bf-d32b-48f7-bcdc-0c5e3f21ea63&quot;,&quot;phoneNumber&quot;:&quot;062/888-321&quot;,&quot;phoneNumberConfirmed&quot;:false,&quot;twoFactorEnabled&quot;:false,&quot;lockoutEnd&quot;:null,&quot;lockoutEnabled&quot;:true,&quot;accessFailedCount&quot;:0},&quot;clientId&quot;:null,&quot;client&quot;:null,&quot;status&quot;:&quot;Otvoren&quot;} 
  </code></pre>
  <p>Now, I want to fill my popup modal with this data <code>applicationuser.name</code>, <code>applicationuser.email</code>, <code>applicationuser.phonenumber</code></p>
  <p>So far what I create is Controller Action</p>
  <pre><code>    [HttpGet]
  public IActionResult GetByName(string name)
  {
      var obj = _unitOfwork.Ticket.GetAll(x =&gt; x.ApplicationUser.Name == name);
      return Json(new { data = obj });
  }
  </code></pre>
  <p>Here is popup PartialView.cshtml</p>
  <pre><code>@model VmSTicketing.Models.ViewModels.TicketVM
  
  &lt;div class=&quot;modal fade&quot; id=&quot;userDetails&quot;&gt;
      &lt;div class=&quot;modal-dialog&quot;&gt;
          &lt;div class=&quot;modal-content&quot;&gt;
              &lt;div class=&quot;modal-header&quot;&gt;
                  &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;modal&quot; aria-hidden=&quot;true&quot;&gt;X&lt;/button&gt;
                  &lt;h3 class=&quot;modal-title&quot;&gt;Podaci o Useru&lt;/h3&gt;
              &lt;/div&gt;
              &lt;div class=&quot;modal-body&quot;&gt;
                  &lt;div class=&quot;row dataTable&quot;&gt;
                      &lt;div class=&quot;col-md-4&quot;&gt;
                          &lt;label class=&quot;control-label&quot;&gt;Ime i Prezime&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;col-md-8&quot;&gt;                       
                          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; readonly id=&quot;ImePrezime&quot; name=&quot;ImePrezime&quot;&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;br&gt;
  
                  &lt;div class=&quot;row dataTable&quot;&gt;
                      &lt;div class=&quot;col-md-4&quot;&gt;
                          &lt;label class=&quot;control-label&quot;&gt;Email Adresa&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;col-md-8&quot;&gt;
                          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; readonly id=&quot;Email&quot; name=&quot;Email&quot;&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;br&gt;
  
                  &lt;div class=&quot;row dataTable&quot;&gt;
                      &lt;div class=&quot;col-md-4&quot;&gt;
                          &lt;label class=&quot;control-label&quot;&gt;Broj Telefona&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;col-md-8&quot;&gt;
                          &lt;input type=&quot;text&quot; readonly  class=&quot;form-control&quot; id=&quot;BrTel&quot; name=&quot;BrTel&quot;&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;br /&gt;
  
                  &lt;div class=&quot;row dataTable&quot;&gt;
                      &lt;div class=&quot;col-md-4&quot;&gt;
                          &lt;label class=&quot;control-label&quot;&gt;Klijent&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;col-md-8&quot;&gt;
                          &lt;input type=&quot;text&quot; readonly  class=&quot;form-control&quot; id=&quot;klijent&quot; name=&quot;klijent&quot;&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>And here is my function for popup modal which also work</p>
  <p>Here is datatable column</p>
  <pre><code>{
                  &quot;data&quot;: &quot;applicationUser.name&quot;,
                  &quot;width&quot;: &quot;10%&quot;,
                  &quot;render&quot;: function (data) {
                      return '&lt;a id=&quot;' + data + '&quot; class=&quot;text-info user-details&quot;  data-toggle=&quot;modal&quot; data-target=&quot;#userDetails&quot; href=&quot;' + data + '&quot; target_blank&gt;' + data + '&lt;/a&gt;'
                  }
              },
  
  
  
  
  
        $(&quot;#tblData&quot;).on(&quot;click&quot;, &quot;a.user-details&quot;, function () {
      var name = $(this).attr('id');
      /*console.log(name);*/
      $.get(&quot;/Manager/Ticket/GetByName?name=&quot; + name, function (result) {
          console.log(result);
          $('#ImePrezime').val(result.data.applicationUser.name);
          $('#Email').val(result.data.applicationUser.email);
          $('#BrTel').val(result.data.applicationUser.phoneNumber);
          $(&quot;#userDetails&quot;).modal({ show: true })
      });
  });
  </code></pre>
  <p>Here is output</p>
  <p><a href="https://i.stack.imgur.com/Z9E7H.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z9E7H.jpg" alt="enter image description here" /></a></p>
  <p>Please let me know if you more additional information since I have no idea what source code to provide, but this code which I provide is I think important.
  I am not sure do I need to call this function <code>onClick</code> event hendler or what else to do ?
  Any help?</p>