cannot update jquery-timepicker data

cannot update jquery-timepicker data

I am just using time picker from https://github.com/jonthornton/jquery-timepicker , and using DisableTimeRanges feature to pickup valid time range from some date.

My idea is when user selects a date, then update Disable Time Ranges on time field with ajax.

The problem is time field can only display first time range data from server, and cannot refresh updated data from server.

my code:

  1. $('#dateStart').on('change', function () {
  2. $.ajax({
  3. url: "/showStartTime",
  4. dataType: 'text',
  5. contentType: "text/plain; charset=utf-8",
  6. data: {
  7. startDay: $('#dateStart').val()
  8. },
  9. success: function (data) {
  10. var obj = eval("(" + data + ")");
  11. $('#timeStart').timepicker(obj);
  12. }
  13. });
  14. });



#dateStart is date field, and #timeStart is time field

Can someone help solve this issue for me? thanks