title: Bootstrap datepicker refresh/update after first selection
body: <p>I am using bootstrap-datepicker inline mode on a form like this.
  Code from the form</p>
  
  <pre><code> &lt;div id="frmdate" data-date=""&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And and updating the data-date value with jquery ajax returned date from server.</p>
  
  <p>On datepicker date selection we write the value to a hidden input..</p>
  
  <pre><code>&lt;input type="hidden" name="ttsasssd" id="ttsasssd"&gt;
  </code></pre>
  
  <p>Datpicker code..</p>
  
  <p>The <code>strtdatedump</code> variable is the date received from ajax. I write to the "data-date" value on each form submission. To set the new date for datepicker.</p>
  
  <pre><code>$("#frmdate").attr("data-date", strtdatedump);
  $("#frmdate").datepicker({format: "yyyy/mm/dd"});
  $("#frmdate").on('changeDate', function(){
  $("#ttsasssd").val(
      $("#frmdate").datepicker('getFormattedDate')
     );
  });
  </code></pre>
  
  <p>I tried to use the datepickers update() method to update the datepickers but it is not showing the current set dates.</p>
  
  <pre><code>$("#frmdate").datepicker('update');
  </code></pre>
  
  <p>How do I update the datepicker after each form submission ?</p>
  
  <p>Edit 1</p>
  
  <p>How I fetch the new dates,</p>
  
  <p>Editing the question because I can not write comments,  I am fetching the new dates with ajax. I tried to store the new ajax send date in a variable and add that in datepicker but it does not work. What I am doing wrong ???  </p>
  
  <pre><code>$("#getAddForm").click(function(event){
    $.ajax({
      url: "/top-thirty-assamese/getdate/",
      type: "GET",
      dataType: "json",
      success: function(data){
        if(data !== "")
        {
            var strtdatedump = data.start;
            $("#frmdate").attr("data-date", strtdatedump);
             $("#frmdate").datepicker('update', strtdatedump);
             $("#frmdate").on('changeDate', function(){
                $("#ttsasssd").val(
                    $("#frmdate").datepicker('getFormattedDate')
                  );
             }); 
  </code></pre>