jquery - Bootstrap datepicker refresh/update after first selection -


i using bootstrap-datepicker inline mode on form this. code form

 <div id="frmdate" data-date=""></div> 

and , updating data-date value jquery ajax returned date server.

on datepicker date selection write value hidden input..

<input type="hidden" name="ttsasssd" id="ttsasssd"> 

datpicker code..

the strtdatedump variable date received ajax. write "data-date" value on each form submission. set new date datepicker.

$("#frmdate").attr("data-date", strtdatedump); $("#frmdate").datepicker({format: "yyyy/mm/dd"}); $("#frmdate").on('changedate', function(){ $("#ttsasssd").val(     $("#frmdate").datepicker('getformatteddate')    ); }); 

i tried use datepickers update() method update datepickers not showing current set dates.

$("#frmdate").datepicker('update'); 

how update datepicker after each form submission ?

edit 1

how fetch new dates,

editing question because can not write comments, fetching new dates ajax. tried store new ajax send date in variable , add in datepicker not work. doing wrong ???

$("#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')                 );            });  

you can call update on datpicker directly new value date (i way , works):

$("#frmdate").datepicker('update', "2015/09/39"); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -