jquery - Calculate End Date, based on start date and drop down list of number of Package in cakephp -


i know if possible calculate end date based on user picking start date , select list of number of package.

i.e. select silver package , choose start date of 1 jan - in theory date field automatically update date 30 days later, i.e. 2 february.

is there way this?

kind information have 3 package silver 30 gold 40 platinum 50

in view page   <script type="text/javascript">    $(function() { $( "#start_date" ).datepicker({         dateformat:'yy-mm-dd'  }); $( "#end_date" ).datepicker({         dateformat:'yy-mm-dd'  });  $('#start_date').bind('change', function() {  $.ajax({                 sync: false,                 type: 'post',                 data: 'subscription_id=' + $("#packagename").val() + '&start_date=' + $("#start_date").val(),                 url: '<?php echo router::url(array('controller' => 'subhistories', 'action' => 'diff'), true); ?>',                 success: function(e)                 {                      $('#end_date').val(e);                  }             });               return false;   }); }); </script>  

create 1 function in controller likde diff() {

        $save=$this->subscription->find('first',array('conditions'=> array('subscription_id'=>$_request['subscription_id'])));          echo date('y-m-d', strtotime($_request['start_date'].  ' + ' .$save['subscription']['no_of_days']. ' days'));           exit;          } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -