title: Partial view not working on ajax call mvc5
body: <blockquote>
  <p>i am working on view which is actually create view for customer.</p>
  <p>On &quot;Create&quot; View, I am using textbox to search the items from db and then display their detail on _part(Partial View)...The partial view action is correctly getting string and processing request except displaying partial view data on create view....</p>
  </blockquote>
  <p><strong>Create View:</strong></p>
  <pre><code>&lt;form&gt;
      &lt;input type=&quot;text&quot; id=&quot;enginNo&quot; /&gt;
      &lt;input type=&quot;button&quot; value=&quot;search&quot; id=&quot;btnSearch&quot; /&gt;
  &lt;/form&gt;
  &lt;div id=&quot;info&quot; class=&quot;col-md-10&quot;&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
      $(document).ready(function () {
          alert(&quot;hola&quot;);
          $(&quot;#btnSearch&quot;).click(function () {
              alert(&quot;hola2&quot;);
              var enginNo = $('#enginNo').val();
              $.ajax(
                  {
                      alert:(&quot;ajax called&quot;),
                      type: 'Get',
                      data: { enginNo: enginNo },
                      url: '@Url.Action(&quot;CheckRecord&quot;)',
                      success: function (result) {
                          $('#result').html(result);
                      }
                  });
          });
      });
  &lt;/script&gt;
  </code></pre>
  <p><strong>Returning string &quot;enginNo&quot; to partial view action below:</strong></p>
  <pre><code>public PartialViewResult CheckRecord(string enginNo)
  {
      ViewBag.records = db.StockDMs.Where(ve =&gt; ve.EngineNumber == enginNo);
      if (Request.IsAjaxRequest())
      {
          return PartialView(&quot;_part&quot;, ViewBag.records);
  
      }
      else
          return null;
  }
  </code></pre>
  <p><strong>PartialView:</strong></p>
  <pre><code>@model SM.CRM.AutosLoan.Models.Core.DomainModels.StockDM
  
  &lt;div&gt;
      @{
          Layout = Request.IsAjaxRequest() ? null : &quot;~/Views/Shared/SMClient.cshtml&quot;;
      }
      @foreach (var item in ViewBag.records)
       {
       &lt;dd&gt;
                  @item.AutoCompanyBrand.Name
              &lt;/dd&gt;
  
              &lt;dd&gt;
                  @item.SMClientBranch.Name
              &lt;/dd&gt;
       }
  </code></pre>
  <p><strong>I don't know what i am doing wrong, thought if somebody help..Thanks for your time:-)</strong></p>