title: How to update the textbox value without page refresh using ajax in mvc
body: <p>Hi i want to update the texbox value from database without page refresh. I tried to update the textbox value without page refresh it updating the value without page refresh but it not correctly bind to that textbox.</p>
  
  <p><strong>My Controller</strong></p>
  
  <pre><code>    public ActionResult PageRefresh()
      {
          return View();
      }
      [HttpGet]
      public JsonResult GetDateTime()
      {
          var date = db.SYNCs.Select(e =&gt; new { currentdataimport = e.SDT }).FirstOrDefault();
          var currentDataimporttime = date.currentdataimport;
          var finalvalue = new { success = true, time = currentDataimporttime.ToString() };
          return Json(finalvalue,JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p><strong>My View Code</strong></p>
  
  <pre><code>    &lt;table&gt;
      &lt;tr&gt;
      &lt;td id="Refreshtable"&gt;
          &lt;input type="text" id="Dateimporttime" /&gt;
      &lt;/td&gt;
      &lt;/tr&gt;
     &lt;/table&gt;
  
     &lt;script src="~/Scripts/jquery-1.10.2.min.js"&gt;&lt;/script&gt;
     &lt;script&gt;
       $(function () {
       $.ajax({
           type: "GET",
           url: '@Url.Action("GetDateTime","Page")',
           datatype: "Json",
           success: function (data) {
               $("#Dateimporttime").val(data.time)
               }
           });
        });
       &lt;/script&gt; 
     &lt;script type="text/javascript"&gt;
  
     $(function () {
      setInterval(function () {  $('#Refreshtable').load('/Page/GetDateTime'); }, 50000),
          $("#Dateimporttime").val(data.time)
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Here first i load the textbox value using ajax. Then i set the reload function for that particular table especailly textbox.Then again i load the recent value which is in db to that textbox.</p>
  
  <p>But its not updating the value in textbox.it updating the value but not binding in that textbox. Any one tell me what mistake i did and correct my mistake. I tried my level best to explain the issue. Any one understand my issue and give me solution for my problem.</p>
  
  <p>Advance Thanks.</p>